You are here

public function MapControlDeleteForm::submitForm in Openlayers 8.4

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/MapControlDeleteForm.php, line 73

Class

MapControlDeleteForm
Form for deleting a map control.

Namespace

Drupal\openlayers\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->olMap
    ->deleteMapControl($this->mapControl);
  $this->olMap
    ->save();
  $this
    ->messenger()
    ->addStatus($this
    ->t('The control %name has been deleted from the map.', [
    '%name' => $this->mapControl
      ->label(),
  ]));
  $form_state
    ->setRedirectUrl($this->olMap
    ->toUrl('edit-form'));
}