function WorkspaceForm::activate

Same name and namespace in other branches
  1. 11.x core/modules/workspaces/src/Form/WorkspaceForm.php \Drupal\workspaces\Form\WorkspaceForm::activate()
  2. 11.x core/modules/workspaces_ui/src/Form/WorkspaceForm.php \Drupal\workspaces_ui\Form\WorkspaceForm::activate()
  3. main core/modules/workspaces_ui/src/Form/WorkspaceForm.php \Drupal\workspaces_ui\Form\WorkspaceForm::activate()

Form submission handler for the 'submit' action.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

File

core/modules/workspaces/src/Form/WorkspaceForm.php, line 162

Class

WorkspaceForm
Form controller for the workspace edit forms.

Namespace

Drupal\workspaces\Form

Code

public function activate(array $form, FormStateInterface $form_state) : void {
  $this->workspaceManager
    ->setActiveWorkspace($this->entity);
  $this->messenger()
    ->addMessage($this->t('%label is now the active workspace.', [
    '%label' => $this->entity
      ->label(),
  ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.