Last active
August 29, 2015 14:06
-
-
Save davestacey/569ae271b32b0cf7969c to your computer and use it in GitHub Desktop.
maps.module - Custom Drupal module to control leaflet and geoJSON data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function maps_preprocess_page(&$variables) { | |
//dpm("es_maps_preprocess_page"); | |
// Set full basepath for JS | |
global $base_path; | |
$my_base_path = $GLOBALS['base_url'] . $GLOBALS['base_path'] . drupal_get_path('module', 'es_maps'); | |
//dpm('$my_base_path', $my_base_path); | |
// pass full module path to settings for JS | |
$my_settings = array( | |
'basePath' => $my_base_path, | |
); | |
drupal_add_js(array('customSettings' => $my_settings), 'setting'); | |
if (isset($variables['node']) && $variables['node']->type == 'map_geojson') { | |
//dpm("map_geojson module"); | |
// Add js custom | |
drupal_add_js(drupal_get_path('module', 'es_maps') . '/es_maps.js'); | |
$variables['scripts'] = drupal_get_js(); | |
}//if (isset | |
}//function es_maps_preprocess_page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment