public function ModalPublishedForm::submitForm in Modal 8.3
Same name and namespace in other branches
- 8.2 src/Form/ModalPublishedForm.php \Drupal\modal_page\Form\ModalPublishedForm::submitForm()
Pubished the entity and log the event. logger() replaces the watchdog.
Overrides ContentEntityForm::submitForm
File
- src/
Form/ ModalPublishedForm.php, line 53
Class
- ModalPublishedForm
- Class: ModalPublishedForm.
Namespace
Drupal\modal_page\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$entity = $this
->getEntity();
if ($entity->published->value) {
$entity->published->value = FALSE;
}
else {
$entity->published->value = TRUE;
}
$entity
->save();
$form_state
->setRedirect('modal_page.default');
}