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 />

JavaScript is used in <strong>Drupal</strong> like in most other web applications. It is used to<br />

power features such as the overlay, autocomplete, drag and drop, and so on. This<br />

chapter will focus on the JavaScript integration into <strong>Drupal</strong> and how to use the<br />

JavaScript helpers.<br />

Some of the important topics this chapter will cover are:<br />

• How to add JavaScript to pages through <strong>Drupal</strong><br />

• Altering JavaScript added to a page by <strong>Drupal</strong> core and other modules<br />

• Using the helper functions built into <strong>Drupal</strong><br />

• Working with theming and translations in JavaScript<br />

• Working with AJAX and <strong>Drupal</strong><br />

By the end of this chapter you should have the base knowledge to work with<br />

JavaScript within <strong>Drupal</strong>.<br />

JavaScript inside <strong>Drupal</strong><br />

JavaScript is an integral part of <strong>Drupal</strong> providing dynamic features, a unique<br />

administration experience, and a library of JavaScript for module developers to use.<br />

The jQuery JavaScript framework comes bundled with <strong>Drupal</strong> along with several<br />

jQuery plugins. JavaScript is provided using the Library API which is available for<br />

modules to take advantage of.<br />

Along with jQuery 1.4.4 the following plugins are provided by <strong>Drupal</strong>:<br />

• jQuery UI 1.8.6<br />

• jQuery Cookie, a simple, lightweight utility plugin for reading, writing, and<br />

deleting cookies

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

Saved successfully!

Ooh no, something went wrong!