You are here

public function Group::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

src/Plugin/Layer/Group/Group.php, line 167
Layer: Heatmap.

Class

Group
Class Group.

Namespace

Drupal\openlayers\Plugin\Layer\Group

Code

public function optionsFormSubmit(array $form, array &$form_state) {
  $layers_enabled = array_filter($form_state['values']['grouplayers'], function ($item) {
    return (bool) $item['enabled'];
  });
  uasort($layers_enabled, function ($a, $b) {
    return $a['weight'] - $b['weight'];
  });
  $this
    ->setOption('grouplayers', array_keys($layers_enabled));
  $form_state['item'] = $this
    ->getExport();
}