signalpoint / jDrupal

A JavaScript Library and API for Drupal Applications
http://jdrupal.tylerfrankenstein.com/
GNU General Public License v2.0
76 stars 38 forks source link

How to Create Custom jDrupal Module? #83

Closed signalpoint closed 6 years ago

signalpoint commented 6 years ago

In jDrupal 7 (without DrupalGap 7), how do you create a custom module?

signalpoint commented 6 years ago

Simply declare a custom module like so:

jDrupal.modules.custom.example = {};

Then you can take advantage of jDrupal's hooks, for example:

/**
 * Implements hook_services_preprocess().
 */
function example_services_preprocess(options) {
  //console.log(options);

  if (options.service == 'user' && options.resource == 'login') {
    // Do something special to the user login call...
  }

}