SlideShare a Scribd company logo
1 of 33
Download to read offline
Demystifying AJAX Callback
Commands
(in Drupal 8)
2016.midcamp.org/node/48
MidCampĀ 2016
BackgroundĀ imageĀ modifiedĀ versionĀ ofĀ "ChicagoĀ Bean"Ā byĀ SergeyĀ Gabdurakhmanov
Mike Miles
@mikemiles86
GenuineĀ ( )wearegenuine.com
mikeĀ­miles.com
Goals of this Session
ExplainĀ AJAXĀ callbackĀ commands
DemonstrateĀ AJAXĀ callbackĀ commands
OutlineĀ customĀ AJAXĀ callbackĀ commands
What are Callback Commands
FunctionsĀ returnedĀ andĀ invokedĀ byĀ allĀ AjaxĀ responses
AllowĀ serverĀ toĀ dictateĀ clientĀ functionality
DefinedĀ byĀ DrupalĀ coreĀ (25)Ā andĀ Modules
Callback Commands: Server Side
FollowsĀ namingĀ conventionĀ [CommandName]Command(.php)
ClassĀ thatĀ implementsĀ CommandInterface
DefinesĀ aĀ 'render'Ā method
ReturnsĀ anĀ associativeĀ array
ContainsĀ elementĀ withĀ keyĀ ofĀ 'command'
'Command'Ā valueĀ isĀ nameĀ ofĀ JavaScriptĀ method
Anatomy of a Callback Command: PHP
01 use DrupalCoreAjaxCommandInterface;
02
03 // An AJAX command for calling [commandName]() JavaScript method.
04 class [CommandName]Command implements CommandInterface {
05
06 // Implements DrupalCoreAjaxCommandInterface:render().
07 public function render() {
08 return array(
09 'command' => '[commandName]', // Name of JavaScript Method.
10 // other request arguments...
11 );
12 }
13 }
[CommandName]Command.php
CallbackĀ commandĀ classesĀ needĀ toĀ implementĀ CommandInterfaceĀ (linesĀ #1Ā &Ā #4).Ā MustĀ defineĀ aĀ 'render'
methodĀ (linesĀ #7Ā Ā­Ā #12),Ā thatĀ returnsĀ anĀ associativeĀ array.Ā AssociativeĀ arrayĀ mustĀ containĀ anĀ element
withĀ theĀ keyĀ ofĀ 'command'Ā andĀ aĀ vlaueĀ thatĀ isĀ aĀ nameĀ ofĀ theĀ javascriptĀ method.Ā AdditionalĀ argumentsĀ are
passedĀ asĀ responseĀ data.
Callback Commands: Client Side
WrapperĀ forĀ additionalĀ javascript
MethodĀ attachedĀ toĀ 'Drupal.AjaxCommands.prototype'Ā object
TakesĀ 3Ā arguments
ajax
response
status
Anatomy of a Callback Command: JavaScript
01 /**
02 * [commandName description]
03 *
04 * @param {Drupal.Ajax} [ajax]
05 * @param {object} response
06 * @param {number} [status]
07 */
08 Drupal.AjaxCommands.prototype.[commandName] = function(ajax, response, status){
09
10 // Custom javascript goes here ...
11
12 }
CallbackĀ CommandĀ needsĀ toĀ beĀ attachedĀ asĀ aĀ methodĀ toĀ theĀ Drupal.AjaxCommands.prototypeĀ object
(lineĀ #8).Ā CommandĀ acceptsĀ threeĀ argumentsĀ andĀ isĀ aĀ wrapperĀ forĀ additionalĀ javascript.
Callback Commands Are...
FunctionsĀ returnedĀ andĀ invokedĀ byĀ allĀ AjaxĀ responses
PHPĀ ClassesĀ thatĀ implementĀ CommandInterface
MethodsĀ attachedĀ toĀ 'Drupal.AjaxCommands.prototype'
How to Use Callback Commands
AttachĀ DrupalĀ AjaxĀ libraryĀ toĀ theĀ requestingĀ page
CreateĀ aĀ callbackĀ methodĀ thatĀ returnsĀ anĀ AjaxResponseĀ object
AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ usingĀ 'addCommand'
Example: The "Remove" Command
ExampleĀ ofĀ usingĀ theĀ removeĀ callbackĀ command.Ā LinkĀ triggersĀ ajaxĀ requestĀ whichĀ returnsĀ responseĀ with
'remove'Ā commandĀ targetingĀ imageĀ id.
01 namespace Drupalremove_exampleController;
02 use DrupalCoreControllerControllerBase;
03
04 class RemoveExampleController extends ControllerBase {
05
06 // Return output for displaying an image and ajax link for removing it.
07 public static function demo() {
08 $output['description']['#markup'] = '<p>' . t('The following is an example of using
09 // ...
10 // Attach the ajax library.
11 $output['#attached']['library'][] = 'core/drupal.ajax';
12 // Return render array
13 return $output;
14 }
15 // ...
16 }
remove_example/src/Controller/RemoveExampleController.php
PagesĀ thatĀ wantĀ toĀ useĀ AjaxĀ needĀ toĀ includeĀ theĀ ajaxĀ library.Ā OnĀ lineĀ #11Ā attachingĀ theĀ coreĀ DrupalĀ Ajax
libraryĀ toĀ theĀ renderĀ arrayĀ forĀ theĀ page.
01 namespace Drupalremove_exampleController;
02 use DrupalCoreControllerControllerBase;
03 use DrupalCoreAjaxAjaxResponse;
04 use DrupalCoreAjaxRemoveCommand;
05
06 class RemoveExampleController extends ControllerBase {
07 // ...
08 /**
09 * Callback method for removing image from 'remove-example' page.
10 *
11 * @return DrupalCoreAjaxAjaxResponse|mixed
12 */
13 public static function removeImage() {
14 // Create an Ajax Response object.
15 $response = new AjaxResponse();
16 // Add a remove command.
17 $response->addCommand(new RemoveCommand('#example_remove_wrapper'));
18 // Return the response object.
19 return $response;
20 }
21 }
remove_example/src/Controller/RemoveExampleController.php
ClassesĀ usedĀ forĀ AjaxĀ requestsĀ needĀ toĀ includeĀ neededĀ classesĀ (lineĀ #3,Ā LineĀ #4).Ā CallbackĀ methodĀ needs
toĀ returnĀ anĀ ajaxĀ commandĀ (lineĀ #14)Ā andĀ attachĀ commandsĀ usingĀ 'addCommand'Ā methodĀ (lineĀ #16).
To Use Callback Commands...
AttachĀ DrupalĀ AjaxĀ libraryĀ toĀ theĀ requestingĀ page
CreateĀ callbackĀ methodĀ thatĀ returnsĀ AjaxResponse
AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
Creating Custom Callback Commands
RequiresĀ aĀ customĀ module
NeedĀ toĀ defineĀ customĀ phpĀ classes
NeedĀ toĀ defineĀ customĀ javascriptĀ methods
Custom Callback Commands: PHP
FollowĀ namingĀ conventionĀ [CommandName]Command(.php)
ImplementĀ CommandInterface
DefineĀ aĀ 'render'Ā method
ReturnĀ anĀ associativeĀ arrayĀ withĀ 'command'Ā element
PlaceĀ inĀ 'src/Ajax/'Ā directoryĀ ofĀ module
Example: SlideRemoveCommand
01 namespace Drupalremove_exampleAjax;
02
03 use DrupalCoreAjaxCommandInterface;
04 // An AJAX command for calling the jQuery slideUp() and remove() methods.
05 class SlideRemoveCommand implements CommandInterface {
06 // Constructs an SlideRemoveCommand object.
07 public function __construct($selector, $duration = NULL) {
08 $this->selector = $selector;
09 $this->duration = $duration;
10 }
11 // Implements DrupalCoreAjaxCommandInterface:render().
12 public function render() {
13 return array(
14 'command' => 'slideRemove',
15 'selector' => $this->selector,
16 'duration' => $this->duration,
17 );
18 }
19 }
remove_example/src/Ajax/SlideRemoveCommand.php
AnĀ exampleĀ ofĀ creatingĀ aĀ customĀ 'SlideRemove'Ā callbackĀ commandĀ PHPĀ Class.Ā ClassĀ followsĀ naming
conventionsĀ andĀ implementsĀ CommandInterfaceĀ (lineĀ #5).Ā DefinesĀ aĀ renderĀ methodĀ (lineĀ #12),Ā which
returnsĀ anĀ associativeĀ arrayĀ withĀ aĀ 'command'Ā keyedĀ element.Ā (linesĀ #13Ā Ā­Ā #17).
Custom Callback Commands: JavaScript
AttachĀ methodĀ toĀ 'Drupal.AjaxCommands.prototype'Ā object
TakeĀ 3Ā arguments
ajax
response
status
AddĀ JavaScriptĀ toĀ aĀ customĀ library
Example: slideRemove
01 (function ($, window, Drupal, drupalSettings) {
02 'use strict';
03 // Command to slide up content before removing it from the page.
04 Drupal.AjaxCommands.prototype.slideRemove = function(ajax, response, status){
05 var duration = response.duration ? response.duration : "slow";
06
07 $(response.selector).each(function() {
08 $(this).slideUp(duration, function() {
09 $(this).remove();
10 });
11 });
12 }
13 })(jQuery, this, Drupal, drupalSettings);
remove_example/js/ajax.js
AnĀ exampleĀ ofĀ creatingĀ aĀ customĀ 'slideRemove'Ā callbackĀ commandĀ javascriptĀ method.Ā AttachedĀ to
'Drupal.AjaxCommands.prototype'Ā objectĀ andĀ acceptsĀ threeĀ argumentsĀ (lineĀ #4).Ā UsesĀ responseĀ dataĀ for
additionalĀ javascriptĀ functionalityĀ (linesĀ #5Ā Ā­Ā #13).
Example: remove_example/remove-example library
01 remove-example:
02 version: VERSION
03 js:
04 js/ajax.js: {}
05 dependencies:
06 - core/drupal.ajax
remove_example.libraries.yml
JavascriptĀ fileĀ thatĀ containsĀ customĀ 'slideRemove'Ā commandĀ isĀ addedĀ toĀ aĀ libraryĀ deffinitionĀ (linesĀ #3Ā Ā­
#4).Ā AddĀ coreĀ DrupalĀ AjaxĀ libraryĀ asĀ aĀ dependencyĀ soĀ thatĀ itĀ isĀ includedĀ (linesĀ #5Ā Ā­Ā #6).
To Create Custom Callback Commands...
UseĀ aĀ customĀ module
DefineĀ classesĀ thatĀ implementsĀ CommandInterface
AttachĀ JavaScriptĀ method(s)Ā toĀ 'Drupal.AjaxCommands.prototype'
Using Custom Callback Commands
AttachĀ customĀ libraryĀ toĀ theĀ requestingĀ page
AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
Example: The "slideRemove" Command
ExampleĀ ofĀ usingĀ theĀ customĀ slideRemoveĀ callbackĀ command.Ā LinkĀ triggersĀ ajaxĀ requestĀ whichĀ returns
responseĀ withĀ 'slideRemove'Ā commandĀ targetingĀ imageĀ id.
01 namespace Drupalremove_exampleController;
02 use DrupalCoreControllerControllerBase;
03
04 class RemoveExampleController extends ControllerBase {
05
06 // Return output for displaying an image and ajax link for removing it.
07 public static function demo() {
08 $output['description']['#markup'] = '<p>' . t('The following is an example of using
09 // ...
10 // Attach custom Ajax command library.
11 $output['#attached']['library'][] = 'remove_example/remove-example';
12 // Return render array
13 return $output;
14 }
15 // ...
16 }
remove_example/src/Controller/RemoveExampleController.php
CustomĀ JavascriptĀ libraryĀ needsĀ toĀ beĀ includedĀ onĀ requestingĀ page,Ā soĀ thatĀ methodsĀ areĀ attached.
AttachingĀ libraryĀ toĀ renderĀ arrayĀ onĀ lineĀ #11.
01 namespace Drupalremove_exampleController;
02 use DrupalCoreControllerControllerBase;
03 use DrupalCoreAjaxAjaxResponse;
04 use DrupalCoreremove_exampleSlideRemoveCommand;
05
06 class RemoveExampleController extends ControllerBase {
07 // ...
08 /**
09 * Callback method for removing image from 'remove-example' page.
10 *
11 * @return DrupalCoreAjaxAjaxResponse|mixed
12 */
13 public static function removeImage() {
14 // Create an Ajax Response object.
15 $response = new AjaxResponse();
16 // Add a remove command.
17 $response->addCommand(new SlideRemoveCommand('#example_remove_wrapper', 'slow'
18 // Return the response object.
19 return $response;
20 }
21 }
remove_example/src/Controller/RemoveExampleController.php
LikeĀ coreĀ callbackĀ commands,Ā customĀ commandĀ classesĀ haveĀ toĀ beĀ includedĀ inĀ callbackĀ controllerĀ (line
#4)Ā andĀ addedĀ toĀ AjaxResponseĀ inĀ callbackĀ methodĀ (lineĀ #17).
To Use Custom Callback Commands...
AttachĀ customĀ libraryĀ toĀ theĀ requestingĀ page
AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
Review
AJAX Callback Commands Are...
FunctionsĀ returnedĀ andĀ invokedĀ byĀ allĀ AjaxĀ responses
PHPĀ ClassesĀ implementingĀ CommandInterface
MethodsĀ attachedĀ toĀ 'Drupal.AjaxCommands.prototype'Ā object
To Use AJAX Callback Commands...
AttachĀ DrupalĀ AjaxĀ libraryĀ toĀ theĀ requestingĀ page
CreateĀ callbackĀ methodĀ thatĀ returnsĀ AjaxResponse
AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
To Create AJAX Callback Commands...
UseĀ aĀ customĀ module
DefineĀ classesĀ thatĀ implementsĀ CommandInterface
AttachĀ JavaScriptĀ methodsĀ toĀ 'Drupal.AjaxCommands.prototype'
To Use Custom AJAX Callback Commands...
AttachĀ customĀ libraryĀ toĀ theĀ requestingĀ page
SameĀ processĀ asĀ usingĀ coreĀ commands
Resources
DrupalĀ 8Ā AJAXĀ Api:Ā bit.ly/Drupal8Ajax
ThisĀ Presentation:Ā bit.ly/Mid16Ajax
PresentationĀ Slides:Ā bit.ly/Mid16AjaxSlides
ExampleĀ Code:Ā bit.ly/Mid16AjaxEx
CreatingĀ CommandsĀ inĀ D8:Ā bit.ly/D8AjaxCmds
Ā #midcamp Ā @WeAreGenuine D8Ā AJAXĀ Ā /Ā Ā MichaelĀ Miles
Thank You!
Feedback/Questions:Ā @mikemiles86

More Related Content

What's hot

Sylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationSylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationŁukasz Chruściel
Ā 
Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)Fabien Potencier
Ā 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web servicesMichelangelo van Dam
Ā 
Magento 2 | Declarative schema
Magento 2 | Declarative schemaMagento 2 | Declarative schema
Magento 2 | Declarative schemaKiel Pykett
Ā 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shintutorialsruby
Ā 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDAleix VergƩs
Ā 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentNuvole
Ā 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
Ā 
PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2eugenio pombi
Ā 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09Daniel Bryant
Ā 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteLeonardo Proietti
Ā 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & RESTHugo Hamon
Ā 
IndexedDB - Querying and Performance
IndexedDB - Querying and PerformanceIndexedDB - Querying and Performance
IndexedDB - Querying and PerformanceParashuram N
Ā 
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceMeet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceIvan Chepurnyi
Ā 
Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016John Napiorkowski
Ā 
ŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to z
ŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to zŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to z
ŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to zLEDC 2016
Ā 
#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...
#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...
#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...ķƒ‘ķ¬ė¦¬ģ—ė“€(źµ¬ė”œė””ģ§€ķ„øė‹Øģ§€ģ—­3ė²ˆģ¶œźµ¬ 2ė¶„ź±°ė¦¬)
Ā 

What's hot (20)

Sylius and Api Platform The story of integration
Sylius and Api Platform The story of integrationSylius and Api Platform The story of integration
Sylius and Api Platform The story of integration
Ā 
Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)
Ā 
Zend framework service
Zend framework serviceZend framework service
Zend framework service
Ā 
Introduction to Zend Framework web services
Introduction to Zend Framework web servicesIntroduction to Zend Framework web services
Introduction to Zend Framework web services
Ā 
Magento 2 | Declarative schema
Magento 2 | Declarative schemaMagento 2 | Declarative schema
Magento 2 | Declarative schema
Ā 
Alfredo-PUMEX
Alfredo-PUMEXAlfredo-PUMEX
Alfredo-PUMEX
Ā 
td_mxc_rubyrails_shin
td_mxc_rubyrails_shintd_mxc_rubyrails_shin
td_mxc_rubyrails_shin
Ā 
Decoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDDDecoupling the Ulabox.com monolith. From CRUD to DDD
Decoupling the Ulabox.com monolith. From CRUD to DDD
Ā 
First Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven DevelopmentFirst Steps in Drupal Code Driven Development
First Steps in Drupal Code Driven Development
Ā 
RicoLiveGrid
RicoLiveGridRicoLiveGrid
RicoLiveGrid
Ā 
Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5Rich domain model with symfony 2.5 and doctrine 2.5
Rich domain model with symfony 2.5 and doctrine 2.5
Ā 
PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2PHPUnit elevato alla Symfony2
PHPUnit elevato alla Symfony2
Ā 
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09L2 Web App Development Guest Lecture At University of Surrey 20/11/09
L2 Web App Development Guest Lecture At University of Surrey 20/11/09
Ā 
Symfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il clienteSymfony2, creare bundle e valore per il cliente
Symfony2, creare bundle e valore per il cliente
Ā 
Silex meets SOAP & REST
Silex meets SOAP & RESTSilex meets SOAP & REST
Silex meets SOAP & REST
Ā 
IndexedDB - Querying and Performance
IndexedDB - Querying and PerformanceIndexedDB - Querying and Performance
IndexedDB - Querying and Performance
Ā 
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for PerformanceMeet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Meet Magento Sweden - Magento 2 Layout and Code Compilation for Performance
Ā 
Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016Catalyst patterns-yapc-eu-2016
Catalyst patterns-yapc-eu-2016
Ā 
ŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to z
ŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to zŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to z
ŠŠ½Š°Ń‚Š¾Š»ŠøŠ¹ ŠŸŠ¾Š»ŃŠŗŠ¾Š² - Drupal.ajax framework from a to z
Ā 
#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...
#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...
#34.ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ & ė§ˆģ“ė°”ķ‹°ģŠ¤ (Spring Framework, MyBatis)_ģŠ¤ķ”„ė§ķ”„ė ˆģž„ģ›Œķ¬ ź°•ģ¢Œ, ģž¬ģ§ģžķ™˜źø‰źµģœ”,ģ‹¤ģ—…ģžźµģœ”,źµ­...
Ā 

Similar to MidCamp 2016 - Demystifying AJAX Callback Commands in Drupal 8

Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsSoĆ³s GĆ”bor
Ā 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For ManagersAgileThought
Ā 
Models, controllers and views
Models, controllers and viewsModels, controllers and views
Models, controllers and viewspriestc
Ā 
Controllers & actions
Controllers & actionsControllers & actions
Controllers & actionsEyal Vardi
Ā 
Serverless archtiectures
Serverless archtiecturesServerless archtiectures
Serverless archtiecturesIegor Fadieiev
Ā 
Power shell examples_v4
Power shell examples_v4Power shell examples_v4
Power shell examples_v4JoeDinaso
Ā 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with codekamal kotecha
Ā 
JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"
JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"
JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"GeeksLab Odessa
Ā 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207patter
Ā 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenJoshua Long
Ā 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodeSWIFTotter Solutions
Ā 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
Ā 
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVCzeeshanhanif
Ā 
ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2
ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2
ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2Masao Maeda
Ā 
Scala4sling
Scala4slingScala4sling
Scala4slingday
Ā 
Spring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗ
Spring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗSpring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗ
Spring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗRecruit Lifestyle Co., Ltd.
Ā 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
Ā 
Sqlapi0.1
Sqlapi0.1Sqlapi0.1
Sqlapi0.1jitendral
Ā 

Similar to MidCamp 2016 - Demystifying AJAX Callback Commands in Drupal 8 (20)

Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.js
Ā 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
Ā 
Patterns Are Good For Managers
Patterns Are Good For ManagersPatterns Are Good For Managers
Patterns Are Good For Managers
Ā 
Models, controllers and views
Models, controllers and viewsModels, controllers and views
Models, controllers and views
Ā 
Controllers & actions
Controllers & actionsControllers & actions
Controllers & actions
Ā 
Serverless archtiectures
Serverless archtiecturesServerless archtiectures
Serverless archtiectures
Ā 
Power shell examples_v4
Power shell examples_v4Power shell examples_v4
Power shell examples_v4
Ā 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
Ā 
JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"
JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"
JSLab. ŠŠ»ŠµŠŗсŠµŠ¹ Š’Š¾Š»ŠŗŠ¾Š². "React Š½Š° ŠæрŠ°ŠŗтŠøŠŗŠµ"
Ā 
React lecture
React lectureReact lecture
React lecture
Ā 
symfony on action - WebTech 207
symfony on action - WebTech 207symfony on action - WebTech 207
symfony on action - WebTech 207
Ā 
Spring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in HeavenSpring and Cloud Foundry; a Marriage Made in Heaven
Spring and Cloud Foundry; a Marriage Made in Heaven
Ā 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better Code
Ā 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
Ā 
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
Ā 
ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2
ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2
ꬔäø–代PHPćƒ•ćƒ¬ćƒ¼ćƒ ćƒÆćƒ¼ć‚Æ Symfony2
Ā 
Scala4sling
Scala4slingScala4sling
Scala4sling
Ā 
Spring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗ
Spring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗSpring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗ
Spring悒ē”Ø恄恟ē¤¾å†…ćƒ©ć‚¤ćƒ–ćƒ©ćƒŖ開ē™ŗ
Ā 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Ā 
Sqlapi0.1
Sqlapi0.1Sqlapi0.1
Sqlapi0.1
Ā 

More from Michael Miles

Inclusive Design: Thinking beyond accessibility
Inclusive Design: Thinking beyond accessibilityInclusive Design: Thinking beyond accessibility
Inclusive Design: Thinking beyond accessibilityMichael Miles
Ā 
How to Foster Team Success
How to Foster Team SuccessHow to Foster Team Success
How to Foster Team SuccessMichael Miles
Ā 
How to Foster Team Success | Drupalcon 2017
How to Foster Team Success | Drupalcon 2017How to Foster Team Success | Drupalcon 2017
How to Foster Team Success | Drupalcon 2017Michael Miles
Ā 
Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017
Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017
Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017Michael Miles
Ā 
Inclusive Design: Thinking Beyond Accessibility | DCNL 2017
Inclusive Design: Thinking Beyond Accessibility | DCNL 2017Inclusive Design: Thinking Beyond Accessibility | DCNL 2017
Inclusive Design: Thinking Beyond Accessibility | DCNL 2017Michael Miles
Ā 
The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017Michael Miles
Ā 
INCLUSIVE DESIGN: Going beyond Accessibility
INCLUSIVE DESIGN: Going beyond AccessibilityINCLUSIVE DESIGN: Going beyond Accessibility
INCLUSIVE DESIGN: Going beyond AccessibilityMichael Miles
Ā 
Inclusive Design
Inclusive DesignInclusive Design
Inclusive DesignMichael Miles
Ā 
The Flexibility of Drupal 8
The Flexibility of Drupal 8The Flexibility of Drupal 8
The Flexibility of Drupal 8Michael Miles
Ā 
The Flexibility of Drupal
The Flexibility of DrupalThe Flexibility of Drupal
The Flexibility of DrupalMichael Miles
Ā 
Badcamp 2015 - R.E.A.D: Four Steps for Selecting The Right Modules
Badcamp 2015 - R.E.A.D: Four Steps for Selecting The Right ModulesBadcamp 2015 - R.E.A.D: Four Steps for Selecting The Right Modules
Badcamp 2015 - R.E.A.D: Four Steps for Selecting The Right ModulesMichael Miles
Ā 
The Flexibility of Drupal
The Flexibility of DrupalThe Flexibility of Drupal
The Flexibility of DrupalMichael Miles
Ā 
The Flexibility of Drupal
The Flexibility of DrupalThe Flexibility of Drupal
The Flexibility of DrupalMichael Miles
Ā 
Flcamp2015 - R.E.A.D: Four steps for selecting the right modules
Flcamp2015 - R.E.A.D: Four steps for selecting the right modulesFlcamp2015 - R.E.A.D: Four steps for selecting the right modules
Flcamp2015 - R.E.A.D: Four steps for selecting the right modulesMichael Miles
Ā 
R.E.A.D: Four steps for selecting the right modules Midcamp 2015
R.E.A.D: Four steps for selecting the right modules Midcamp 2015R.E.A.D: Four steps for selecting the right modules Midcamp 2015
R.E.A.D: Four steps for selecting the right modules Midcamp 2015Michael Miles
Ā 
How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014Michael Miles
Ā 
To Patch or Custom: How to decide when to patch a contrib module or go custom...
To Patch or Custom: How to decide when to patch a contrib module or go custom...To Patch or Custom: How to decide when to patch a contrib module or go custom...
To Patch or Custom: How to decide when to patch a contrib module or go custom...Michael Miles
Ā 

More from Michael Miles (17)

Inclusive Design: Thinking beyond accessibility
Inclusive Design: Thinking beyond accessibilityInclusive Design: Thinking beyond accessibility
Inclusive Design: Thinking beyond accessibility
Ā 
How to Foster Team Success
How to Foster Team SuccessHow to Foster Team Success
How to Foster Team Success
Ā 
How to Foster Team Success | Drupalcon 2017
How to Foster Team Success | Drupalcon 2017How to Foster Team Success | Drupalcon 2017
How to Foster Team Success | Drupalcon 2017
Ā 
Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017
Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017
Inclusive Design: Thinking Beyond Accessibility | NERDSummit 2017
Ā 
Inclusive Design: Thinking Beyond Accessibility | DCNL 2017
Inclusive Design: Thinking Beyond Accessibility | DCNL 2017Inclusive Design: Thinking Beyond Accessibility | DCNL 2017
Inclusive Design: Thinking Beyond Accessibility | DCNL 2017
Ā 
The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017The Flexibility of Drupal 8 | DCNLights 2017
The Flexibility of Drupal 8 | DCNLights 2017
Ā 
INCLUSIVE DESIGN: Going beyond Accessibility
INCLUSIVE DESIGN: Going beyond AccessibilityINCLUSIVE DESIGN: Going beyond Accessibility
INCLUSIVE DESIGN: Going beyond Accessibility
Ā 
Inclusive Design
Inclusive DesignInclusive Design
Inclusive Design
Ā 
The Flexibility of Drupal 8
The Flexibility of Drupal 8The Flexibility of Drupal 8
The Flexibility of Drupal 8
Ā 
The Flexibility of Drupal
The Flexibility of DrupalThe Flexibility of Drupal
The Flexibility of Drupal
Ā 
Badcamp 2015 - R.E.A.D: Four Steps for Selecting The Right Modules
Badcamp 2015 - R.E.A.D: Four Steps for Selecting The Right ModulesBadcamp 2015 - R.E.A.D: Four Steps for Selecting The Right Modules
Badcamp 2015 - R.E.A.D: Four Steps for Selecting The Right Modules
Ā 
The Flexibility of Drupal
The Flexibility of DrupalThe Flexibility of Drupal
The Flexibility of Drupal
Ā 
The Flexibility of Drupal
The Flexibility of DrupalThe Flexibility of Drupal
The Flexibility of Drupal
Ā 
Flcamp2015 - R.E.A.D: Four steps for selecting the right modules
Flcamp2015 - R.E.A.D: Four steps for selecting the right modulesFlcamp2015 - R.E.A.D: Four steps for selecting the right modules
Flcamp2015 - R.E.A.D: Four steps for selecting the right modules
Ā 
R.E.A.D: Four steps for selecting the right modules Midcamp 2015
R.E.A.D: Four steps for selecting the right modules Midcamp 2015R.E.A.D: Four steps for selecting the right modules Midcamp 2015
R.E.A.D: Four steps for selecting the right modules Midcamp 2015
Ā 
How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
How to R.E.A.D: Steps for how to select the correct module @NEWDCamp 2014
Ā 
To Patch or Custom: How to decide when to patch a contrib module or go custom...
To Patch or Custom: How to decide when to patch a contrib module or go custom...To Patch or Custom: How to decide when to patch a contrib module or go custom...
To Patch or Custom: How to decide when to patch a contrib module or go custom...
Ā 

Recently uploaded

WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
Ā 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
Ā 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
Ā 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...SUHANI PANDEY
Ā 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...SUHANI PANDEY
Ā 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
Ā 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
Ā 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...SUHANI PANDEY
Ā 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
Ā 
( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...nilamkumrai
Ā 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
Ā 
Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
Ā 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
Ā 
āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men šŸ”mehsanašŸ” Escorts...
āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men  šŸ”mehsanašŸ”   Escorts...āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men  šŸ”mehsanašŸ”   Escorts...
āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men šŸ”mehsanašŸ” Escorts...nirzagarg
Ā 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...roncy bisnoi
Ā 

Recently uploaded (20)

Low Sexy Call Girls In Mohali 9053900678 šŸ„µHave Save And Good Place šŸ„µ
Low Sexy Call Girls In Mohali 9053900678 šŸ„µHave Save And Good Place šŸ„µLow Sexy Call Girls In Mohali 9053900678 šŸ„µHave Save And Good Place šŸ„µ
Low Sexy Call Girls In Mohali 9053900678 šŸ„µHave Save And Good Place šŸ„µ
Ā 
WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp šŸ“ž 8448380779 āœ…Call Girls In Mamura Sector 66 ( Noida)
Ā 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
Ā 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
Ā 
valsad Escorts Service ā˜Žļø 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ā˜Žļø 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ā˜Žļø 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ā˜Žļø 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Ā 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Ā 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Ā 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
Ā 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
Ā 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
Ā 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Ā 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Ā 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
Ā 
( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls šŸŽ—ļø 9352988975 Sizzling | Escorts | G...
Ā 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
Ā 
šŸ“±Dehradun Call Girls Service šŸ“±ā˜Žļø +91'905,3900,678 ā˜ŽļøšŸ“± Call Girls In Dehradun šŸ“±
šŸ“±Dehradun Call Girls Service šŸ“±ā˜Žļø +91'905,3900,678 ā˜ŽļøšŸ“± Call Girls In Dehradun šŸ“±šŸ“±Dehradun Call Girls Service šŸ“±ā˜Žļø +91'905,3900,678 ā˜ŽļøšŸ“± Call Girls In Dehradun šŸ“±
šŸ“±Dehradun Call Girls Service šŸ“±ā˜Žļø +91'905,3900,678 ā˜ŽļøšŸ“± Call Girls In Dehradun šŸ“±
Ā 
Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ā˜Ž 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Ā 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
Ā 
āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men šŸ”mehsanašŸ” Escorts...
āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men  šŸ”mehsanašŸ”   Escorts...āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men  šŸ”mehsanašŸ”   Escorts...
āž„šŸ” 7737669865 šŸ”ā–» mehsana Call-girls in Women Seeking Men šŸ”mehsanašŸ” Escorts...
Ā 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Ā 

MidCamp 2016 - Demystifying AJAX Callback Commands in Drupal 8

  • 1. Demystifying AJAX Callback Commands (in Drupal 8) 2016.midcamp.org/node/48 MidCampĀ 2016 BackgroundĀ imageĀ modifiedĀ versionĀ ofĀ "ChicagoĀ Bean"Ā byĀ SergeyĀ Gabdurakhmanov
  • 3. Goals of this Session ExplainĀ AJAXĀ callbackĀ commands DemonstrateĀ AJAXĀ callbackĀ commands OutlineĀ customĀ AJAXĀ callbackĀ commands
  • 4. What are Callback Commands FunctionsĀ returnedĀ andĀ invokedĀ byĀ allĀ AjaxĀ responses AllowĀ serverĀ toĀ dictateĀ clientĀ functionality DefinedĀ byĀ DrupalĀ coreĀ (25)Ā andĀ Modules
  • 5. Callback Commands: Server Side FollowsĀ namingĀ conventionĀ [CommandName]Command(.php) ClassĀ thatĀ implementsĀ CommandInterface DefinesĀ aĀ 'render'Ā method ReturnsĀ anĀ associativeĀ array ContainsĀ elementĀ withĀ keyĀ ofĀ 'command' 'Command'Ā valueĀ isĀ nameĀ ofĀ JavaScriptĀ method
  • 6. Anatomy of a Callback Command: PHP 01 use DrupalCoreAjaxCommandInterface; 02 03 // An AJAX command for calling [commandName]() JavaScript method. 04 class [CommandName]Command implements CommandInterface { 05 06 // Implements DrupalCoreAjaxCommandInterface:render(). 07 public function render() { 08 return array( 09 'command' => '[commandName]', // Name of JavaScript Method. 10 // other request arguments... 11 ); 12 } 13 } [CommandName]Command.php CallbackĀ commandĀ classesĀ needĀ toĀ implementĀ CommandInterfaceĀ (linesĀ #1Ā &Ā #4).Ā MustĀ defineĀ aĀ 'render' methodĀ (linesĀ #7Ā Ā­Ā #12),Ā thatĀ returnsĀ anĀ associativeĀ array.Ā AssociativeĀ arrayĀ mustĀ containĀ anĀ element withĀ theĀ keyĀ ofĀ 'command'Ā andĀ aĀ vlaueĀ thatĀ isĀ aĀ nameĀ ofĀ theĀ javascriptĀ method.Ā AdditionalĀ argumentsĀ are passedĀ asĀ responseĀ data.
  • 7. Callback Commands: Client Side WrapperĀ forĀ additionalĀ javascript MethodĀ attachedĀ toĀ 'Drupal.AjaxCommands.prototype'Ā object TakesĀ 3Ā arguments ajax response status
  • 8. Anatomy of a Callback Command: JavaScript 01 /** 02 * [commandName description] 03 * 04 * @param {Drupal.Ajax} [ajax] 05 * @param {object} response 06 * @param {number} [status] 07 */ 08 Drupal.AjaxCommands.prototype.[commandName] = function(ajax, response, status){ 09 10 // Custom javascript goes here ... 11 12 } CallbackĀ CommandĀ needsĀ toĀ beĀ attachedĀ asĀ aĀ methodĀ toĀ theĀ Drupal.AjaxCommands.prototypeĀ object (lineĀ #8).Ā CommandĀ acceptsĀ threeĀ argumentsĀ andĀ isĀ aĀ wrapperĀ forĀ additionalĀ javascript.
  • 10. How to Use Callback Commands AttachĀ DrupalĀ AjaxĀ libraryĀ toĀ theĀ requestingĀ page CreateĀ aĀ callbackĀ methodĀ thatĀ returnsĀ anĀ AjaxResponseĀ object AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ usingĀ 'addCommand'
  • 11. Example: The "Remove" Command ExampleĀ ofĀ usingĀ theĀ removeĀ callbackĀ command.Ā LinkĀ triggersĀ ajaxĀ requestĀ whichĀ returnsĀ responseĀ with 'remove'Ā commandĀ targetingĀ imageĀ id.
  • 12. 01 namespace Drupalremove_exampleController; 02 use DrupalCoreControllerControllerBase; 03 04 class RemoveExampleController extends ControllerBase { 05 06 // Return output for displaying an image and ajax link for removing it. 07 public static function demo() { 08 $output['description']['#markup'] = '<p>' . t('The following is an example of using 09 // ... 10 // Attach the ajax library. 11 $output['#attached']['library'][] = 'core/drupal.ajax'; 12 // Return render array 13 return $output; 14 } 15 // ... 16 } remove_example/src/Controller/RemoveExampleController.php PagesĀ thatĀ wantĀ toĀ useĀ AjaxĀ needĀ toĀ includeĀ theĀ ajaxĀ library.Ā OnĀ lineĀ #11Ā attachingĀ theĀ coreĀ DrupalĀ Ajax libraryĀ toĀ theĀ renderĀ arrayĀ forĀ theĀ page.
  • 13. 01 namespace Drupalremove_exampleController; 02 use DrupalCoreControllerControllerBase; 03 use DrupalCoreAjaxAjaxResponse; 04 use DrupalCoreAjaxRemoveCommand; 05 06 class RemoveExampleController extends ControllerBase { 07 // ... 08 /** 09 * Callback method for removing image from 'remove-example' page. 10 * 11 * @return DrupalCoreAjaxAjaxResponse|mixed 12 */ 13 public static function removeImage() { 14 // Create an Ajax Response object. 15 $response = new AjaxResponse(); 16 // Add a remove command. 17 $response->addCommand(new RemoveCommand('#example_remove_wrapper')); 18 // Return the response object. 19 return $response; 20 } 21 } remove_example/src/Controller/RemoveExampleController.php ClassesĀ usedĀ forĀ AjaxĀ requestsĀ needĀ toĀ includeĀ neededĀ classesĀ (lineĀ #3,Ā LineĀ #4).Ā CallbackĀ methodĀ needs toĀ returnĀ anĀ ajaxĀ commandĀ (lineĀ #14)Ā andĀ attachĀ commandsĀ usingĀ 'addCommand'Ā methodĀ (lineĀ #16).
  • 14. To Use Callback Commands... AttachĀ DrupalĀ AjaxĀ libraryĀ toĀ theĀ requestingĀ page CreateĀ callbackĀ methodĀ thatĀ returnsĀ AjaxResponse AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
  • 15. Creating Custom Callback Commands RequiresĀ aĀ customĀ module NeedĀ toĀ defineĀ customĀ phpĀ classes NeedĀ toĀ defineĀ customĀ javascriptĀ methods
  • 16. Custom Callback Commands: PHP FollowĀ namingĀ conventionĀ [CommandName]Command(.php) ImplementĀ CommandInterface DefineĀ aĀ 'render'Ā method ReturnĀ anĀ associativeĀ arrayĀ withĀ 'command'Ā element PlaceĀ inĀ 'src/Ajax/'Ā directoryĀ ofĀ module
  • 17. Example: SlideRemoveCommand 01 namespace Drupalremove_exampleAjax; 02 03 use DrupalCoreAjaxCommandInterface; 04 // An AJAX command for calling the jQuery slideUp() and remove() methods. 05 class SlideRemoveCommand implements CommandInterface { 06 // Constructs an SlideRemoveCommand object. 07 public function __construct($selector, $duration = NULL) { 08 $this->selector = $selector; 09 $this->duration = $duration; 10 } 11 // Implements DrupalCoreAjaxCommandInterface:render(). 12 public function render() { 13 return array( 14 'command' => 'slideRemove', 15 'selector' => $this->selector, 16 'duration' => $this->duration, 17 ); 18 } 19 } remove_example/src/Ajax/SlideRemoveCommand.php AnĀ exampleĀ ofĀ creatingĀ aĀ customĀ 'SlideRemove'Ā callbackĀ commandĀ PHPĀ Class.Ā ClassĀ followsĀ naming conventionsĀ andĀ implementsĀ CommandInterfaceĀ (lineĀ #5).Ā DefinesĀ aĀ renderĀ methodĀ (lineĀ #12),Ā which returnsĀ anĀ associativeĀ arrayĀ withĀ aĀ 'command'Ā keyedĀ element.Ā (linesĀ #13Ā Ā­Ā #17).
  • 18. Custom Callback Commands: JavaScript AttachĀ methodĀ toĀ 'Drupal.AjaxCommands.prototype'Ā object TakeĀ 3Ā arguments ajax response status AddĀ JavaScriptĀ toĀ aĀ customĀ library
  • 19. Example: slideRemove 01 (function ($, window, Drupal, drupalSettings) { 02 'use strict'; 03 // Command to slide up content before removing it from the page. 04 Drupal.AjaxCommands.prototype.slideRemove = function(ajax, response, status){ 05 var duration = response.duration ? response.duration : "slow"; 06 07 $(response.selector).each(function() { 08 $(this).slideUp(duration, function() { 09 $(this).remove(); 10 }); 11 }); 12 } 13 })(jQuery, this, Drupal, drupalSettings); remove_example/js/ajax.js AnĀ exampleĀ ofĀ creatingĀ aĀ customĀ 'slideRemove'Ā callbackĀ commandĀ javascriptĀ method.Ā AttachedĀ to 'Drupal.AjaxCommands.prototype'Ā objectĀ andĀ acceptsĀ threeĀ argumentsĀ (lineĀ #4).Ā UsesĀ responseĀ dataĀ for additionalĀ javascriptĀ functionalityĀ (linesĀ #5Ā Ā­Ā #13).
  • 20. Example: remove_example/remove-example library 01 remove-example: 02 version: VERSION 03 js: 04 js/ajax.js: {} 05 dependencies: 06 - core/drupal.ajax remove_example.libraries.yml JavascriptĀ fileĀ thatĀ containsĀ customĀ 'slideRemove'Ā commandĀ isĀ addedĀ toĀ aĀ libraryĀ deffinitionĀ (linesĀ #3Ā Ā­ #4).Ā AddĀ coreĀ DrupalĀ AjaxĀ libraryĀ asĀ aĀ dependencyĀ soĀ thatĀ itĀ isĀ includedĀ (linesĀ #5Ā Ā­Ā #6).
  • 21. To Create Custom Callback Commands... UseĀ aĀ customĀ module DefineĀ classesĀ thatĀ implementsĀ CommandInterface AttachĀ JavaScriptĀ method(s)Ā toĀ 'Drupal.AjaxCommands.prototype'
  • 22. Using Custom Callback Commands AttachĀ customĀ libraryĀ toĀ theĀ requestingĀ page AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
  • 23. Example: The "slideRemove" Command ExampleĀ ofĀ usingĀ theĀ customĀ slideRemoveĀ callbackĀ command.Ā LinkĀ triggersĀ ajaxĀ requestĀ whichĀ returns responseĀ withĀ 'slideRemove'Ā commandĀ targetingĀ imageĀ id.
  • 24. 01 namespace Drupalremove_exampleController; 02 use DrupalCoreControllerControllerBase; 03 04 class RemoveExampleController extends ControllerBase { 05 06 // Return output for displaying an image and ajax link for removing it. 07 public static function demo() { 08 $output['description']['#markup'] = '<p>' . t('The following is an example of using 09 // ... 10 // Attach custom Ajax command library. 11 $output['#attached']['library'][] = 'remove_example/remove-example'; 12 // Return render array 13 return $output; 14 } 15 // ... 16 } remove_example/src/Controller/RemoveExampleController.php CustomĀ JavascriptĀ libraryĀ needsĀ toĀ beĀ includedĀ onĀ requestingĀ page,Ā soĀ thatĀ methodsĀ areĀ attached. AttachingĀ libraryĀ toĀ renderĀ arrayĀ onĀ lineĀ #11.
  • 25. 01 namespace Drupalremove_exampleController; 02 use DrupalCoreControllerControllerBase; 03 use DrupalCoreAjaxAjaxResponse; 04 use DrupalCoreremove_exampleSlideRemoveCommand; 05 06 class RemoveExampleController extends ControllerBase { 07 // ... 08 /** 09 * Callback method for removing image from 'remove-example' page. 10 * 11 * @return DrupalCoreAjaxAjaxResponse|mixed 12 */ 13 public static function removeImage() { 14 // Create an Ajax Response object. 15 $response = new AjaxResponse(); 16 // Add a remove command. 17 $response->addCommand(new SlideRemoveCommand('#example_remove_wrapper', 'slow' 18 // Return the response object. 19 return $response; 20 } 21 } remove_example/src/Controller/RemoveExampleController.php LikeĀ coreĀ callbackĀ commands,Ā customĀ commandĀ classesĀ haveĀ toĀ beĀ includedĀ inĀ callbackĀ controllerĀ (line #4)Ā andĀ addedĀ toĀ AjaxResponseĀ inĀ callbackĀ methodĀ (lineĀ #17).
  • 26. To Use Custom Callback Commands... AttachĀ customĀ libraryĀ toĀ theĀ requestingĀ page AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
  • 28. AJAX Callback Commands Are... FunctionsĀ returnedĀ andĀ invokedĀ byĀ allĀ AjaxĀ responses PHPĀ ClassesĀ implementingĀ CommandInterface MethodsĀ attachedĀ toĀ 'Drupal.AjaxCommands.prototype'Ā object
  • 29. To Use AJAX Callback Commands... AttachĀ DrupalĀ AjaxĀ libraryĀ toĀ theĀ requestingĀ page CreateĀ callbackĀ methodĀ thatĀ returnsĀ AjaxResponse AttachĀ commandsĀ toĀ AjaxResponseĀ objectĀ withĀ 'addCommand'
  • 30. To Create AJAX Callback Commands... UseĀ aĀ customĀ module DefineĀ classesĀ thatĀ implementsĀ CommandInterface AttachĀ JavaScriptĀ methodsĀ toĀ 'Drupal.AjaxCommands.prototype'
  • 31. To Use Custom AJAX Callback Commands... AttachĀ customĀ libraryĀ toĀ theĀ requestingĀ page SameĀ processĀ asĀ usingĀ coreĀ commands