You are here

function openlayers_render_map in Openlayers 7.2

Same name and namespace in other branches
  1. 6.2 openlayers.module \openlayers_render_map()
  2. 6 openlayers.module \openlayers_render_map()

Render a map by name

Given a map name render it into a full map object.

Parameters

$map: Name of the map

Return value

Map HTML.

9 calls to openlayers_render_map()
OpenLayersCore::testRender in tests/openlayers.test
Test map rendering
openlayers_maps_ui::edit_form in modules/openlayers_ui/plugins/export_ui/openlayers_maps_ui.class.php
Provide the actual editing form.
openlayers_map_content_type_render in plugins/content_types/openlayers_map.inc
Run-time rendering of the body of the block.
openlayers_render_preset in ./openlayers.module
openlayers_simple::render in plugins/boxes/openlayers_simple.inc
Implementation of boxes_content::options_form().

... See full list

File

./openlayers.module, line 358
Main OpenLayers API File

Code

function openlayers_render_map($map = '') {

  // If it's an array, then we have been passed the map data array
  if (is_array($map)) {
    return openlayers_render_map_data($map);
  }

  // If it's a string, then we are passing a map name instead of the whole map object
  // so we need to load the object
  if (!$map || is_string($map)) {
    $map_name = $map;
    if (!$map_name) {
      $map_name = variable_get('openlayers_default_map', 'default');
    }
    $map = openlayers_map_load($map_name);
    if (!is_object($map)) {
      throw new Exception("Failed to load map called " . $map_name);
    }
  }
  return openlayers_render_map_data($map->data);
}