You are here

function hook_openlayers_layers in Openlayers 7.2

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

OpenLayers Layers

This hook tells OpenLayers about the available layers that can be used by name in maps.

Ensure that you are telling CTools about this as well.

Please note, that to support translation for exportable code for potx extraction, you should include separate code of translatable string.

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":

See also

openlayers_example_ctools_plugin_api().

3 functions implement hook_openlayers_layers()

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

openlayers_openlayers_layers in ./openlayers.module
Implements hook_openlayers_layers().
openlayers_test_openlayers_layers in tests/openlayers_test.module
Implements hook_openlayers_layers().
openlayers_views_openlayers_layers in modules/openlayers_views/openlayers_views.module
Implements hook_openlayers_layers().

File

docs/openlayers.api.php, line 134
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_layers() {

  // Taken from openlayers.layers.inc
  $layers = array();
  $layer = new stdClass();
  $layer->api_version = 1;
  $layer->name = 'google_satellite';
  $layer->title = 'Google Maps Satellite';
  $layer->description = 'Google Maps Satellite Imagery.';
  $layer->data = array(
    'isBaseLayer' => TRUE,
    'type' => 'satellite',
    'projection' => array(
      'EPSG:900913',
    ),
    'layer_type' => 'openlayers_layer_type_google',
  );
  $layers[$layer->name] = $layer;
  return $layers;

  // Extra code to support potx extractors
  $potx = array(
    t('Google Maps Satellite'),
    t('Google Maps Satellite Imagery.'),
  );
}