You are here

public function Delete::submitForm in SimpleAds 8

Same name in this branch
  1. 8 src/Form/Groups/Delete.php \Drupal\simpleads\Form\Groups\Delete::submitForm()
  2. 8 src/Form/Ads/Delete.php \Drupal\simpleads\Form\Ads\Delete::submitForm()
  3. 8 src/Form/Campaigns/Delete.php \Drupal\simpleads\Form\Campaigns\Delete::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

src/Form/Campaigns/Delete.php, line 81

Class

Delete
Delete advertisement campaign form.

Namespace

Drupal\simpleads\Form\Campaigns

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $options = $this->campaign
    ->getOptions(TRUE);
  $this->campaign
    ->getSubmitForm('delete', $options, $form_state, $form_state
    ->getValue('campaign_type'), $form_state
    ->getValue('id'));
  $this->campaign
    ->delete();
  $form_state
    ->setRedirect('simpleads.campaigns');
}