Preprocess the Drupal html to add the leaflet library
/**
* Implements template_preprocess_html().
*
*/
function es_maps_preprocess_html(&$variables) {
$path = drupal_get_path_alias();
/* Also could add via html.tpl.php */
function load_leaflet() {
/* Add Leaflet js */
drupal_add_js(drupal_get_path('module', 'es_maps') . '/lib/leaflet-0.7.3/leaflet.js');
$variables['scripts'] = drupal_get_js();
// Option: add from cdn: drupal_add_js('http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js', 'external');
/* Add Leaflet css */
drupal_add_css(drupal_get_path('module', 'es_maps') . '/lib/leaflet-0.7.3/leaflet.css', array('weight' => CSS_THEME, 'preprocess' => TRUE) );
}
$leafletCode = load_leaflet();
// Option: Add when on specific pages.
// if (strpos($path, 'bucketTasks') !== FALSE || strpos($path, 'tasksQA') !== FALSE) {
// }
}