You are here

public function Random::optionsFormSubmit in Openlayers 7.3

Submit callback for the options form.

Parameters

array $form: The form array.

array $form_state: The form_state array by reference.

Overrides Base::optionsFormSubmit

File

modules/openlayers_library/src/Plugin/Source/Random/Random.php, line 65
Source: Random.

Class

Random
Class Random.

Namespace

Drupal\openlayers_library\Plugin\Source\Random

Code

public function optionsFormSubmit(array $form, array &$form_state) {
  parent::optionsFormSubmit($form, $form_state);
  $options = $this
    ->getOptions();
  foreach ($options as $geometry_type => $data) {
    if ($data['setRandomStyle'] != 1) {
      unset($options[$geometry_type]['styles']);
      unset($options[$geometry_type]['setRandomStyle']);
    }
    if ($data['count'] == 0) {
      unset($options[$geometry_type]);
    }
  }
  $this
    ->setOptions($options);
  $form_state['values']['options'] = $options;
  parent::optionsFormSubmit($form, $form_state);
}