public function MapControl::buildConfigurationForm in Openlayers 8.4
File
- src/
MapControl.php, line 88
Class
- MapControl
- Contains details of how a control is joined to a map.
Namespace
Drupal\openlayersCode
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['base'] = array(
'#type' => 'select',
'#title' => t('Base/Overlay'),
'#options' => array(
'base' => 'Base',
'overlay' => 'Overlay',
),
'#default_value' => isset($this->configuration['base']) ? $this->configuration['base'] : 'base',
'#description' => t('Each map may have multiple base layers, but only one of them will be shown at a time.'),
'#size' => 1,
'#prefix' => '<div class="xxxxx">',
'#suffix' => '</div>',
'#required' => TRUE,
);
$form['title'] = [
'#type' => 'textfield',
'#default_value' => isset($this->configuration['title']) ? $this->configuration['title'] : null,
'#title' => t('Title'),
'#description' => t('This is the title of the layer that will be shown in the Layer Switcher.'),
'#size' => 30,
'#maxlength' => 30,
];
$form['visible'] = array(
'#type' => 'select',
'#title' => t('Visible'),
'#options' => array(
'1' => 'Yes',
'0' => 'No',
),
'#size' => 1,
'#description' => t('Select this option for the base layer to be shown initially in the Layer Switcher.'),
'#prefix' => '<div class="xxxxx">',
'#default_value' => isset($this->configuration['visible']) ? $this->configuration['visible'] : 0,
'#suffix' => '</div>',
'#required' => TRUE,
);
return $form;
}