You are here

public function ConditionDeleteForm::submitForm in Block Visibility Groups 8

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/ConditionDeleteForm.php, line 72

Class

ConditionDeleteForm
Provides a form for deleting an condition.

Namespace

Drupal\block_visibility_groups\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->block_visibility_group
    ->removeCondition($this->condition
    ->getConfiguration()['uuid']);
  $this->block_visibility_group
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('The condition %name has been removed.', [
    '%name' => $this->condition
      ->getPluginDefinition()['label'],
  ]));
  $this
    ->setConditionRedirect($form_state);
}