You are here

public function WorkspaceActivateForm::buildForm in Workspace 8

Same name and namespace in other branches
  1. 8.2 src/Form/WorkspaceActivateForm.php \Drupal\workspace\Form\WorkspaceActivateForm::buildForm()

Form constructor.

Parameters

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

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

Return value

array The form structure.

Overrides FormInterface::buildForm

File

src/Form/WorkspaceActivateForm.php, line 23

Class

WorkspaceActivateForm
Handle activation of a workspace on administrative pages.

Namespace

Drupal\workspace\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, WorkspaceInterface $workspace = NULL) {
  $form['workspace_id'] = [
    '#type' => 'hidden',
    '#value' => $workspace
      ->id(),
  ];
  $form['instruction'] = [
    '#type' => 'markup',
    '#prefix' => '<p>',
    '#markup' => $this
      ->t('Would you like to activate the %workspace workspace?', [
      '%workspace' => $workspace
        ->label(),
    ]),
    '#suffix' => '</p>',
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => 'Activate',
  ];
  $form['#title'] = $this
    ->t('Activate workspace %label', [
    '%label' => $workspace
      ->label(),
  ]);
  return $form;
}