You are here

function hook_openlayers_presets in Openlayers 6.2

Same name and namespace in other branches
  1. 6 docs/openlayers.api.php \hook_openlayers_presets()

OpenLayers Presets

Define map presets.

Return value

Return an associative array with index being a unique string identifier, and simple objects with the following properties:

  • "api_version":
  • "name":
  • "title":
  • "data":
3 functions implement hook_openlayers_presets()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

openlayers_openlayers_presets in ./openlayers.module
Implementation of hook_openlayers_presets().
openlayers_test_features_openlayers_presets in tests/openlayers_test_features/openlayers_test_features.openlayers_presets.inc
Implementation of hook_openlayers_presets().
openlayers_test_openlayers_presets in tests/openlayers_test.module
Implementation of hook_openlayers_presets().

File

docs/openlayers.api.php, line 248
Hooks provided by the OpenLayers suite of modules. This file allows hooks to be documented automatically with Doxygen, like on api.drupal.org.

Code

function hook_openlayers_presets() {

  // Taken from openlayers.presets.inc
  $default = new stdClass();
  $default->api_version = 1;
  $default->name = 'default';
  $default->title = t('Default Map');
  $default->description = t('This is the default map preset that comes with the OpenLayers module.');
  $default->data = array(
    'projection' => '900913',
    'width' => 'auto',
    'default_layer' => 'osm_mapnik',
    'height' => '400px',
    'center' => array(
      'initial' => array(
        'centerpoint' => '0,0',
        'zoom' => '2',
      ),
    ),
    'options' => array(
      'displayProjection' => '4326',
      'maxExtent' => openlayers_get_extent('4326'),
    ),
    'behaviors' => array(
      'openlayers_behavior_panzoombar' => array(),
      'openlayers_behavior_layerswitcher' => array(),
      'openlayers_behavior_attribution' => array(),
      'openlayers_behavior_keyboarddefaults' => array(),
      'openlayers_behavior_navigation' => array(),
    ),
    'layers' => array(
      'osm_mapnik' => 'osm_mapnik',
    ),
  );
  return array(
    'default' => $default,
  );
}