function openlayers_behavior_cluster::options_form in Openlayers 6.2
Same name and namespace in other branches
- 7.2 plugins/behaviors/openlayers_behavior_cluster.inc \openlayers_behavior_cluster::options_form()
Provide form for configurations per map.
Overrides openlayers_behavior::options_form
File
- includes/
behaviors/ openlayers_behavior_cluster.inc, line 33 - Implementation of OpenLayers Cluster behavior.
Class
- openlayers_behavior_cluster
- Cluster behavior
Code
function options_form($defaults) {
// Only prompt for vector layers
$vector_layers = array();
foreach ($this->map['layers'] as $id => $name) {
$layer = openlayers_layer_load($id);
if (isset($layer->data['vector']) && $layer->data['vector'] == TRUE) {
$vector_layers[$id] = $name;
}
}
return array(
'clusterlayer' => array(
'#title' => t('Layers'),
'#type' => 'checkboxes',
'#options' => $vector_layers,
'#description' => t('Select layers to cluster.'),
'#default_value' => isset($defaults['clusterlayer']) ? $defaults['clusterlayer'] : array(),
),
'distance' => array(
'#type' => 'textfield',
'#default_value' => isset($defaults['distance']) ? $defaults['distance'] : 20,
'#size' => 5,
'#title' => t('Distance'),
'#description' => t('Pixel distance between features that should ' . 'be considered a single cluster'),
),
'threshold' => array(
'#type' => 'textfield',
'#default_value' => isset($defaults['threshold']) ? $defaults['threshold'] : NULL,
'#size' => 5,
'#title' => t('Threshold'),
'#description' => t('Optional threshold below which original ' . 'features will be added to the layer instead of clusters'),
),
);
}