public function GeofieldWidget::optionsForm in Openlayers 7.3
@TODO What is this return? If it is the form, why is form by reference?
Overrides Base::optionsForm
File
- modules/
openlayers_geofield/ src/ Plugin/ Component/ GeofieldWidget/ GeofieldWidget.php, line 26 - Component: GeofieldWidget.
Class
- GeofieldWidget
- Class GeofieldWidget.
Namespace
Drupal\openlayers_geofield\Plugin\Component\GeofieldWidgetCode
public function optionsForm(array &$form, array &$form_state) {
$form['options']['dataType'] = array(
'#type' => 'checkboxes',
'#title' => t('Data type'),
'#description' => t('If multiple, a control to select the type to use is displayed when drawing.'),
'#multiple' => TRUE,
'#options' => array(
'GeoJSON' => 'GeoJSON',
'KML' => 'KML',
'GPX' => 'GPX',
'WKT' => 'WKT',
),
'#default_value' => $this
->getOption('dataType'),
'#required' => TRUE,
);
$form['options']['dataProjection'] = array(
'#type' => 'radios',
'#title' => t('Data projection'),
'#options' => array(
'EPSG:4326' => 'EPSG:4326',
'EPSG:3857' => 'EPSG:3857',
),
'#description' => t('Defines in which projection the data are read and written.'),
'#default_value' => $this
->getOption('dataProjection', 'EPSG:4326'),
'#required' => TRUE,
);
$form['options']['featureLimit'] = array(
'#type' => 'textfield',
'#title' => t('Feature limit'),
'#description' => t('Limits the number of features. Set to 0 for no limit.'),
'#default_value' => $this
->getOption('featureLimit'),
'#required' => TRUE,
);
$form['options']['showInputField'] = array(
'#type' => 'checkbox',
'#title' => t('Show input field'),
'#description' => t('Shows the data in a textarea.'),
'#default_value' => (int) $this
->getOption('showInputField'),
);
$form['options']['inputFieldName'] = array(
'#type' => 'textfield',
'#title' => t('Name of the input field'),
'#description' => t('Define the name of the input field. You can use brackets to build structure: [geofield][component][data]'),
'#default_value' => $this
->getOption('inputFieldName'),
);
$form['options']['initialData'] = array(
'#type' => 'textarea',
'#title' => t('Initial data'),
'#description' => t('Initial data to set. You can use any of the data types available as "Data type". Ensure the data have the same projection as defined in "Data projection".'),
'#default_value' => $this
->getOption('initialData'),
);
$form['options']['editStyle'] = array(
'#type' => 'select',
'#title' => t('Edit style'),
'#default_value' => $this
->getOption('editStyle'),
'#options' => Openlayers::loadAllAsOptions('style'),
);
$form['options']['editLayer'] = array(
'#type' => 'select',
'#title' => t('Select the widget layer'),
'#default_value' => $this
->getOption('editLayer'),
'#options' => Openlayers::loadAllAsOptions('layer'),
);
$form['options']['editControl'] = array(
'#type' => 'select',
'#title' => t('Select the edit control'),
'#default_value' => $this
->getOption('editControl'),
'#options' => Openlayers::loadAllAsOptions('control'),
);
}