You are here

function openlayers_ui_presets_form_center_map in Openlayers 6.2

Create Centering Map

Create map for interactive default centering

Parameters

$defaults: Array of defults to use for the map of centering and zooming

Return value

Themed map array

1 call to openlayers_ui_presets_form_center_map()
openlayers_ui_presets_form in modules/openlayers_ui/includes/openlayers_ui.presets.inc
Menu Callback for Add Preset

File

modules/openlayers_ui/includes/openlayers_ui.presets.inc, line 725
This file holds the functions handling presets in the Openlayers UI.

Code

function openlayers_ui_presets_form_center_map($defaults = array()) {

  // Pass variables etc. to javascript
  $pass_values = array(
    'openlayersForm' => array(
      'projectionLayers' => openlayers_ui_get_projection_options(),
    ),
  );
  drupal_add_js($pass_values, 'setting');

  // centerpoint & zoom of this preset are overridden
  // by the mapformvalues behavior on page load
  $centermap_def = array(
    'id' => 'openlayers-center-helpmap',
    'projection' => '900913',
    'displayProjection' => '900913',
    'default_layer' => 'osm_mapnik',
    'width' => '500px',
    'height' => '400px',
    'center' => array(
      'initial' => array(
        'centerpoint' => "0, 0",
        'zoom' => 2,
      ),
    ),
    'layers' => array(
      'osm_mapnik',
    ),
    'behaviors' => array(
      'openlayers_behavior_panzoombar' => array(),
      'openlayers_behavior_dragpan' => array(),
      'openlayers_behavior_mapformvalues' => array(),
      'openlayers_behavior_boxselect' => array(),
    ),
  );
  return openlayers_render_map($centermap_def);
}