Live Blogging from DrupalCon Chicago: JavaScript in Drupal 7

Presenters: Kat Bailey

Drush Make Demo File: katbailey.net/resources/d7js

New Ways to add JavaScript in D7:

  1. Add it in the .info (within a module, not just the theme)
  2. drupal_add_js: Function changed a bit since D6, allows additional of external JavaScript
  3. Add it in a Render API: Using the 'attached' property

Altering JavaScript in D7:

hook_js_alter allows coders to change any JavaScript file

JavaScript Libraries

  • hook_library: Defines your JavaScript library
  • hook_library_alter: Alter an existing library