You are here

public function DeleteActivityForm::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/DeleteActivityForm.php, line 41

Class

DeleteActivityForm
Delete activities form.

Namespace

Drupal\activity\Form

Code

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

  // Delete activity event.
  $query = $this->database
    ->delete('activity_events');
  $query
    ->condition('event_id', $this->pathArgs[4]);
  $query
    ->execute();
  $url = Url::fromUri('internal:/admin/activity/');
  $form_state
    ->setRedirectUrl($url);
  drupal_set_message(t('Activity @action deleted.', [
    '@action' => $this->pathArgs[4],
  ]));
}