Gold Sponsors

Drupal 8 and 7 - Ajax framework, ctools extended modal popups, and creating custom commands

From the Form API that started in Drupal 4, Drupal 8 has a lot of changes from straight HTML markup to renderable arrays that can attach assets, Javascript settings, images, caching, HTTP headers, and many other features that would be impossible in the Drupal 4-5 era.

Drupal 7 introduced massive changes in renderable arrays, which are the essentially base of Drupal 8's headless Drupal initiative and making it possible for other modules to alter the markup in a deeper level.

With the popularity of javascript modal popups, many Drupal modules were created to integrate them. But every single module has the problem of the popups only being JS, and it cannot work woth renderable arrays or anything that the renderable arrays can give us (Dynamic JS/CSS attaching, HTTP headers, altering the markup, sanitizing class names, #states, Drupal behaviours to apply JS functi0onality on Ajax-replaced/inserted elements, etc). 

I would like to perform a session on why Drupal's Ajax framework should be used more and more, and how it benefits with a more integrated modal popups, secure Javascript callbacks, silent requests, etc.


Session Agenda:

  - 5-10 minutes: Comparison with lightbox, colorbox vs Ctools modal popups.

  - 10-15 minutes: Quick example of an Ajax call in a Drupal 7. Then, port it to a Drupal 8 Ajaxresponse.

 -  5-8 minutes: Default Ajax commands explained with examples, and how to create new ones.

 -  5-10 minutes: Ctools modal popup, graceful degredation for modals, in-popup commands.

 -  2-5 minutes: Overriding modal popup with custom modal callbacks, dynamic title, dynamic DOM manipulation.

 - Drupal 8's Ajaxresponse explanation (this class now encapsulates Drupal 7's Ajax functionality, so this should be an introduction to port 7's Ajax functionality to a 8).

 - Q&A.


I have spoken and run sessions in a few Drupal camps we had in Sri Lanka, but this would be the first time (if this session gets accepted of course) in India. I need to work on the slides, but ideally I'm planning to explain the concepts rather than showing how to code, which is not really necessary once you have the concepts in the mind. I will have the code examples uploaded to a public git repo for later reference.

Experience level: