function openlayers_component_form_options_submit in Openlayers 7.3
Component options form submit handler.
File
- modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersComponents.inc, line 164 - CTools Export UI plugin definition for components.
Code
function openlayers_component_form_options_submit($form, &$form_state) {
if (isset($form_state['values']['options'])) {
$form_state['item']->options = array_merge((array) $form_state['item']->options, (array) $form_state['values']['options']);
}
if (($component = \Drupal\openlayers\Openlayers::load('Component', $form_state['item'])) == TRUE) {
if (!empty($form_state['item']->attachToMap) && ($map = \Drupal\openlayers\Openlayers::load('map', $form_state['item']->attachToMap)) == TRUE) {
$components = $map
->getOption('layers', array());
$components[] = $component
->getMachineName();
$map
->setOption('components', $components);
\Drupal\openlayers\Openlayers::save($map);
unset($form_state['item']->attachToMap);
}
$component
->optionsFormSubmit($form, $form_state);
}
}