You are here

public function SwitchToLiveForm::submitForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/workspaces/src/Form/SwitchToLiveForm.php \Drupal\workspaces\Form\SwitchToLiveForm::submitForm()
  2. 9 core/modules/workspaces/src/Form/SwitchToLiveForm.php \Drupal\workspaces\Form\SwitchToLiveForm::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

core/modules/workspaces/src/Form/SwitchToLiveForm.php, line 74

Class

SwitchToLiveForm
Provides a form that switches to the live version of the site.

Namespace

Drupal\workspaces\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->workspaceManager
    ->switchToLive();
  $this
    ->messenger()
    ->addMessage($this
    ->t('You are now viewing the live version of the site.'));
}