You are here

public function DeleteActionForm::submitForm in Activity 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 DeleteForm::submitForm

File

src/Form/DeleteActionForm.php, line 42

Class

DeleteActionForm
Delete action form.

Namespace

Drupal\activity\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Delete action.
  $query = $this->database
    ->delete('activity');
  $query
    ->condition('action_id', $this->pathArgs[5]);
  $query
    ->execute();
  $url = Url::fromUri('internal:/activities/all');
  $form_state
    ->setRedirectUrl($url);
  drupal_set_message(t('Action @action deleted.', [
    '@action' => $this->pathArgs[5],
  ]));
}