You are here

function _colorized_gmap_get_map_js_settings in Colorized google maps block 7

Prepare map style values to pass to js.

Parameters

int $delta: Block delta.

object $entity: Map entity.

Return value

array Array of map settings to be passed to js.

1 call to _colorized_gmap_get_map_js_settings()
colorized_gmap_block_view in ./colorized_gmap.module
Implements hook_block_view().

File

./colorized_gmap.module, line 228
Colorized gmap module.

Code

function _colorized_gmap_get_map_js_settings($delta, $entity) {
  module_load_include('inc', 'colorized_gmap', 'colorized_gmap.admin');
  $styles = array();
  $fid = $entity->additional_settings['marker_settings']['marker'];
  if (!is_array($fid) && !empty($fid)) {
    $marker = _colorized_gmap_marker_info($fid, $delta);
    $entity->additional_settings['marker_settings']['marker'] = $marker;
  }

  // @todo: Fix this. Used to make array indexes start with 0.
  foreach ($entity->style as $item) {
    $styles[] = $item;
  }
  $settings = array(
    'blocks' => array(
      $delta => array(
        'latitude' => $entity->latitude,
        'longitude' => $entity->longitude,
        'style' => $styles,
        'additional_settings' => $entity->additional_settings,
        'delta' => $delta,
      ),
    ),
  );
  return $settings;
}