Custom Module Creation JavaScript Edition

Presenter: ndixon
Co-Presenter(s):
n/a

Creating Drupal Modules can be accomplished whether you are a master of PHP or a master of JavaScript or other programming languages.

During this session, we will present a fully functional custom module that was created almost entirely using JavaScript. 

By following these steps you too can create a custom module in Drupal but without the major need for PHP programming. 

How was this done?

We built a custom module that uses JavaScript to do most of the work by using JQuery and Backbone.js and created a multi-step feedback form that submits survey results to Google Analytics and saves data to our Drupal database.

PHP is limited to setting up the module and generating a block.

We followed Drupal.org’s guide for creating a custom module and adding JavaScript to that custom module. Also, using Drupal 8's module structure, we defined the JS libraries and their dependencies.

Drupal 8 with JavaScript API makes it easy to use JavaScript with Drupal and the new JSON:API will make it even easier to use JavaScript to manage data.

In this session, we will cover:
 

- Drupal 8 Module structure

- Defining and using JavaScript libraries

- Live demo of the module

- Calling/using API (JSON:API) to save data into Drupal database

- Using datalayer to push data to Google Analytics

Audience
Experience Level
Intermediate
Session Track