public function Views::optionsForm in Openlayers 7.3
@inheritDoc
Overrides Base::optionsForm
File
- modules/
openlayers_views/ src/ Plugin/ Source/ Views/ Views.php, line 22 - Source: Views.
Class
- Views
- Class Views.
Namespace
Drupal\openlayers_views\Plugin\Source\ViewsCode
public function optionsForm(array &$form, array &$form_state) {
$options = array();
foreach (views_get_all_views() as $view) {
foreach ($view->display as $display) {
if ($display->id != 'default') {
$view
->set_display($display->id);
$viewname = sprintf('%s (%s)', $view->human_name, $view->name);
if ($view->display_handler
->get_option('style_plugin') == 'openlayers_source_vector') {
$options[$viewname][$view->name . ':' . $display->id] = sprintf('%s:%s', $view->human_name, $display->id);
}
if ($view->display_handler
->get_option('style_plugin') == 'openlayers_map_views') {
$options[$viewname][$view->name . ':' . $display->id] = sprintf('%s:%s', $view->human_name, $display->id);
}
}
}
}
$form['options']['view'] = array(
'#type' => 'select',
'#title' => 'View and display',
'#options' => $options,
'#default_value' => $this
->getOption('view'),
'#required' => TRUE,
);
return parent::optionsForm($form, $form_state);
}