function WorkspaceForm::activate

Same name in other branches
  1. 10 core/modules/workspaces/src/Form/WorkspaceForm.php \Drupal\workspaces\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.