function openlayers_map_form_components_submit in Openlayers 7.3
Map components config form submit handler.
File
- modules/
openlayers_ui/ src/ Plugin/ export_ui/ OpenlayersMaps.inc, line 748 - CTools Export UI plugin definition for maps.
Code
function openlayers_map_form_components_submit($form, &$form_state) {
$map = \Drupal\openlayers\Openlayers::load('map', $form_state['item']);
$components_enabled = array_filter($form_state['values']['components'], function ($item) {
return (bool) $item['enabled'];
});
uasort($components_enabled, function ($a, $b) {
return $a['weight'] - $b['weight'];
});
$map
->setOption('components', array_keys($components_enabled));
$form_state['item'] = $map
->getExport();
}