Skip to content

Instantly share code, notes, and snippets.

@drywall
Created July 8, 2014 15:14
Show Gist options
  • Save drywall/be5d2a4b851cece066e8 to your computer and use it in GitHub Desktop.
Save drywall/be5d2a4b851cece066e8 to your computer and use it in GitHub Desktop.
<?php
function sca_map_block_view($delta = '') {
$block = array();
$map_path = drupal_get_path('module', 'sca_map');
//drupal_add_js(array('servicemap' => array('current_status' => 'kewl as a kitten')), 'setting');
$display = array(
'#markup' => servicemap_all(),
'#attached' => array(
'css' => array(
$map_path . '/css/sca_map.css',
),
'js' => array(
'//maps.googleapis.com/maps/api/js?libraries=places&sensor=true' => array('type' => 'external'),
'var data_source = "'. file_create_url(file_build_uri('sca_map/position-data.json')) . '";' => array('type' => 'inline'),
'var state_data_source = "'. file_create_url(file_build_uri('sca_map/state-data.json')) . '";' => array('type' => 'inline'),
'var data_url = "'. $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'sca_map') . '/data/";' => array('type' => 'inline'),
$map_path . '/sca_map.js' => array('type' => 'file', 'scope' => 'footer'),
$map_path . '/scripts/position_map.js' => array('type' => 'file', 'scope' => 'footer'),
),
),
);
switch($delta) {
case 'sca_map':
$block['subject'] = t('Explore the Map');
$block['content'] = drupal_render($display);
}
return $block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment