public function openlayers_views_plugin_map_views::options_form in Openlayers 7.3
Provide a form to edit options for this plugin.
Overrides openlayers_views_plugin_style_source_vector::options_form
File
- modules/
openlayers_views/ views/ openlayers_views_plugin_map_views.inc, line 25 - Style handler that creates a map based on a view.
Class
- openlayers_views_plugin_map_views
- Class openlayers_views_plugin_map_views.
Code
public function options_form(&$form, &$form_state) {
$options = array();
foreach (\Drupal\openlayers\Openlayers::loadAll('map') as $map) {
foreach ($map
->getCollection()
->getObjects('layer') as $layer) {
$key = $map
->getMachineName() . ':' . $layer
->getMachineName();
$value = sprintf("%s: %s (%s)", $map
->getName(), $layer
->getName(), $layer
->getMachineName());
$options[$map
->getName()][$key] = $value;
}
}
$form['base_map_layer'] = array(
'#type' => 'select',
'#title' => 'Base map to use and vector layer to fill with the views features',
'#description' => 'You may choose any vector layer only.',
'#options' => $options,
'#default_value' => $this->options['base_map_layer'],
'#weight' => 1,
'#required' => TRUE,
);
parent::options_form($form, $form_state);
}