public function MapControlFormBase::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/ MapControlFormBase.php, line 113
Class
- MapControlFormBase
- Provides a base form for image effects.
Namespace
Drupal\openlayers\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$form_state
->cleanValues();
// The image effect configuration is stored in the 'data' key in the form,
// pass that through for submission.
$this->mapLayer
->submitConfigurationForm($form['data'], SubformState::createForSubform($form['data'], $form, $form_state));
$this->mapLayer
->setWeight($form_state
->getValue('weight'));
if (!$this->mapLayer
->getUuid()) {
$this->olMap
->addMapLayer($this->mapLayer
->getConfiguration());
// TODO - where is the addMapLayer function ?
}
else {
$this->olMap
->updateMapLayer($this->mapLayer
->getConfiguration());
}
$this->olMap
->save();
$this
->messenger()
->addStatus($this
->t('The image effect was successfully applied.'));
$form_state
->setRedirectUrl($this->olMap
->toUrl('edit-form'));
}