You are here

function openlayers_source_form_options_submit in Openlayers 7.3

Source options config form submit handler.

File

modules/openlayers_ui/src/Plugin/export_ui/OpenlayersSources.inc, line 202
CTools Export UI plugin definition for sources.

Code

function openlayers_source_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 (($source = \Drupal\openlayers\Openlayers::load('Source', $form_state['item'])) == TRUE) {
    if (!empty($form_state['item']->attachToLayer) && ($layer = \Drupal\openlayers\Openlayers::load('layer', $form_state['item']->attachToLayer)) == TRUE) {
      $layer
        ->setOption('source', $source
        ->getMachineName());
      \Drupal\openlayers\Openlayers::save($layer);
      unset($form_state['item']->attachToLayer);
    }
    $source
      ->optionsFormSubmit($form, $form_state);
  }
}