public function DeleteBannerForm::submitForm in Dynamic Banner 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/
forms/ DeleteBannerForm.php, line 38
Class
Namespace
Drupal\dynamic_banner\formsCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$status = $this
->dynamic_banner_admin_delete($this->bid);
//watchdog('bd_contact', 'Deleted BD Contact Submission with id %id.', array('%id' => $this->id));
\Drupal::logger('DynamicBanner')
->error('Deleted BD Contact Submission with id %id.', array(
'%id' => $this->bid,
));
if ($status == 0) {
$this
->messenger()
->addStatus(t('Error while deleting'));
}
else {
$this
->messenger()
->addStatus(t('Banner %id has been deleted.', array(
'%id' => $this->bid,
)));
}
//$form_state['redirect'] = 'admin/content/bd_contact';
$form_state
->setRedirect('cdb.listbanners');
}