You are here

function hook_leaflet_geojson_source_info in Leaflet GeoJSON 8

Same name and namespace in other branches
  1. 7.2 leaflet_geojson.api.php \hook_leaflet_geojson_source_info()
  2. 7 leaflet_geojson.api.php \hook_leaflet_geojson_source_info()

Defines one or more Leaflet GeoJSON sources.

Note: The ids should be valid PHP identifiers.

Return value

array An associative array of sources, keyed by a unique identifier and containing associative arrays with the following keys:

  • title: A human readable title for the source.
  • url: The GeoJSON source url.
  • bbox: (optional) Set to TRUE to activate the Bounding Box strategy.
  • bbox_arg_id: (optional) Specify the bbox argument identifier. Defaults to 'bbox'.
  • type: (optional) The type of source, for example views_geojson.
  • ... (optional) further parameters specific to the source type.

See also

hook_leaflet_geojson_source_info_alter()

1 function implements hook_leaflet_geojson_source_info()

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

leaflet_geojson_leaflet_geojson_source_info in ./leaflet_geojson.module
Implements hook_leaflet_geojson_source_info().
1 invocation of hook_leaflet_geojson_source_info()
leaflet_geojson_source_get_info in ./leaflet_geojson.module
Retrieves the leaflet layer configuration.

File

./leaflet_geojson.api.php, line 31
Hooks provided by the Leaflet GeoJSON module.

Code

function hook_leaflet_geojson_source_info() {
  $sources = [];
  $sources['simple_source'] = [
    'title' => 'My Source',
    'url' => 'http://example.com',
  ];
  $sources['views_geojson_source'] = [
    'title' => 'My Source',
    'url' => 'http://example.com',
    'bbox' => TRUE,
    'bbox_arg_id' => 'bbox',
    'type' => 'views_geojson',
    'view' => 'view_name',
    'view_display' => 'view_display_name',
  ];
  return $sources;
}