18.10.2016 Views

Drupal 7 Module Development

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

JavaScript in <strong>Drupal</strong><br />

ajax_command_settings<br />

ajax_command_settings() is used to add settings to the response. The first<br />

argument is the settings to be sent with the response. If only the first argument is<br />

given, or the second argument is FALSE, then the setting will only be used for the<br />

response. If the second argument, the $merge argument, is set to TRUE the settings<br />

will be merged into <strong>Drupal</strong>.settings.<br />

For more information on the jQuery APIs visit<br />

http://api.jquery.com.<br />

Summary<br />

We have covered the basic principles and commands of using JavaScript and jQuery<br />

within the context of <strong>Drupal</strong>. We started by adding JavaScript to a page as a file,<br />

inline, and as a setting. We continued by looking at adding complete libraries with<br />

dependencies and altering JavaScript right before the page was rendered.<br />

<strong>Drupal</strong> provides helper functions and libraries which are useful in creating <strong>Drupal</strong><br />

modules. We covered how these libraries and some of the more commonly used<br />

elements work.<br />

[ 312 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!