You are here

public function GoogleAdwordsPathCodeDeleteForm::submitForm in Google AdWords Conversion Tracking 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

modules/google_adwords_path/src/Form/GoogleAdwordsPathCodeDeleteForm.php, line 41
Contains \Drupal\google_adwords_path\Form\GoogleAdwordsPathCodeDeleteForm.

Class

GoogleAdwordsPathCodeDeleteForm

Namespace

Drupal\google_adwords_path\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if (google_adwords_path_delete_code_by_cid($form_state
    ->getValues()['cid'])) {
    $message = 'Successfully deleted %name.';
  }
  else {
    $message = 'There was a problem deleting Google Adwords Conversion code, %name.';
  }
  drupal_set_message(t($message, [
    '%name' => $form_state
      ->getValues()['name'],
  ]));
  $path = 'admin/config/system/google_adwords/path';
  $response = new RedirectResponse($path);
  $response
    ->send();
}