Skip to content

Instantly share code, notes, and snippets.

@davestacey
Last active August 29, 2015 14:06
Show Gist options
  • Save davestacey/3a9adde22a4f2e4defbc to your computer and use it in GitHub Desktop.
Save davestacey/3a9adde22a4f2e4defbc to your computer and use it in GitHub Desktop.
Drupal Module - add js
<?php
function ds_maps_preprocess_page(&$variables) {
//dpm("ds_maps_preprocess_page");
if (isset($variables['node']) && $variables['node']->type == 'map_geojson') {
//dpm("map_geojson");
// Add js
drupal_add_js(drupal_get_path('module', 'ds_maps') . '/ds_maps.js');
$variables['scripts'] = drupal_get_js();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment