mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Provide a style for editing Geofield features, and override the default Geofield widget and formatter layer styles.
This commit is contained in:
parent
fb8e00b37b
commit
2d336e500e
|
@ -92,3 +92,17 @@ function farm_map_default_openlayers_layers() {
|
|||
|
||||
return $export;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_default_openlayers_layers_alter().
|
||||
*/
|
||||
function farm_map_default_openlayers_layers_alter(&$layers) {
|
||||
|
||||
// Override the styles of the Geofield Widget and Formatter layers.
|
||||
if (!empty($layers['openlayers_geofield_layer_widget'])) {
|
||||
$layers['openlayers_geofield_layer_widget']->options['style'] = 'farm_map_style_geofield_edit';
|
||||
}
|
||||
if (!empty($layers['openlayers_geofield_layer_formatter'])) {
|
||||
$layers['openlayers_geofield_layer_formatter']->options['style'] = 'farm_map_style_blue';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,5 +89,37 @@ var style = [
|
|||
$ol_style->options = array();
|
||||
$export['farm_map_style_cluster'] = $ol_style;
|
||||
|
||||
// Add a style for Geofield editing.
|
||||
$ol_style = new stdClass();
|
||||
$ol_style->api_version = 1;
|
||||
$ol_style->machine_name = 'farm_map_style_geofield_edit';
|
||||
$ol_style->name = 'Farm Map Geofield Edit';
|
||||
$ol_style->description = '';
|
||||
$ol_style->factory_service = 'openlayers.Style:Circle';
|
||||
$ol_style->options = array(
|
||||
'default' => array(
|
||||
'image' => array(
|
||||
'radius' => 4,
|
||||
'fill' => array(
|
||||
'color' => '0, 0, 0, 0',
|
||||
),
|
||||
'stroke' => array(
|
||||
'color' => '255, 153, 51, 1',
|
||||
'width' => 2,
|
||||
'lineDash' => '0,0',
|
||||
),
|
||||
),
|
||||
'stroke' => array(
|
||||
'color' => '51, 153, 255, 1',
|
||||
'width' => 2,
|
||||
'lineDash' => '0,0',
|
||||
),
|
||||
'fill' => array(
|
||||
'color' => '0, 0, 0, 0',
|
||||
),
|
||||
),
|
||||
);
|
||||
$export['farm_map_style_geofield_edit'] = $ol_style;
|
||||
|
||||
return $export;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue