public function ExportConfirmForm::submitForm in Fixed Block Content 8
The submit handler for the confirm form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: An associative array containing the current state of the form.
Overrides EntityForm::submitForm
File
- src/
Form/ ExportConfirmForm.php, line 71
Class
- ExportConfirmForm
- Export default content confirm form class.
Namespace
Drupal\fixed_block_content\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Export the content stored in config to the block content.
$this->entity
->exportDefaultContent(!empty($form_state
->getValue('update_existing')));
// Set a message that the entity was deleted.
$this
->messenger()
->addMessage($this
->t('Block %label restored to default content.', [
'%label' => $this->entity
->label(),
]));
// Redirect the user to the list controller when complete.
$form_state
->setRedirectUrl($this
->getCancelUrl());
}