mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* @file
|
|
* farm_area.default_openlayers_sources.inc
|
|
*/
|
|
|
|
/**
|
|
* Implements hook_default_openlayers_sources().
|
|
*/
|
|
function farm_area_default_openlayers_sources() {
|
|
$export = array();
|
|
|
|
// Load all available area types.
|
|
$area_types = farm_area_types();
|
|
|
|
// Iterate through the available types, and add a source for each one.
|
|
foreach ($area_types as $key => $type) {
|
|
|
|
// Generate a machine name.
|
|
$machine_name = 'farm_area_source_' . $key;
|
|
|
|
// Build the source.
|
|
$ol_source = new stdClass();
|
|
$ol_source->disabled = FALSE; /* Edit this to true to make a default ol_source disabled initially */
|
|
$ol_source->api_version = 1;
|
|
$ol_source->machine_name = $machine_name;
|
|
$ol_source->name = 'Farm Area: ' . $type['label'];
|
|
$ol_source->description = 'This source is automatically generated by the Farm Area module.';
|
|
$ol_source->factory_service = 'openlayers.Source:GeoJSON';
|
|
$ol_source->options = array(
|
|
'url' => 'farm/areas/geojson/' . $key,
|
|
'useBBOX' => 0,
|
|
'paramForwarding' => 1,
|
|
'reloadOnZoomChange' => 0,
|
|
'reloadOnExtentChange' => 0,
|
|
'geojson_data' => '',
|
|
);
|
|
|
|
// Add the source to the export.
|
|
$export[$machine_name] = $ol_source;
|
|
}
|
|
|
|
return $export;
|
|
}
|