You are here

protected function UpdateForm::getActive in Workspace 8

Get the current active workspace's pointer.

Return value

\Drupal\workspace\WorkspacePointerInterface The active workspace.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

1 call to UpdateForm::getActive()
UpdateForm::submitForm in src/Form/UpdateForm.php
Form submission handler.

File

src/Form/UpdateForm.php, line 103

Class

UpdateForm
The form to update the current workspace with its upstream.

Namespace

Drupal\workspace\Form

Code

protected function getActive() {

  /** @var \Drupal\multiversion\Entity\WorkspaceInterface $workspace */
  $workspace = $this->workspaceManager
    ->getActiveWorkspace();

  /** @var \Drupal\workspace\WorkspacePointerInterface[] $pointers */
  $pointers = $this->entityTypeManager
    ->getStorage('workspace_pointer')
    ->loadByProperties([
    'workspace_pointer' => $workspace
      ->id(),
  ]);
  return reset($pointers);
}