public function ConditionDeleteForm::submitForm in Context 8
Same name and namespace in other branches
- 8.4 modules/context_ui/src/Form/ConditionDeleteForm.php \Drupal\context_ui\Form\ConditionDeleteForm::submitForm()
- 8.0 modules/context_ui/src/Form/ConditionDeleteForm.php \Drupal\context_ui\Form\ConditionDeleteForm::submitForm()
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
- modules/
context_ui/ src/ Form/ ConditionDeleteForm.php, line 112
Class
Namespace
Drupal\context_ui\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Remove the condition and save the context.
$this->context
->removeCondition($this->condition
->getConfiguration()['id'])
->save();
// If this is not an AJAX request then redirect and show a message.
if (!$this
->getRequest()
->isXmlHttpRequest()) {
drupal_set_message($this
->t('The condition %name has been removed.', [
'%name' => $this->condition
->getPluginDefinition()['label'],
]));
$form_state
->setRedirectUrl($this
->getCancelUrl());
}
}