You are here

public static function WorkspacePointer::loadFromWorkspace in Workspace 8

Load a workspace pointer for the given workspace.

Parameters

\Drupal\multiversion\Entity\WorkspaceInterface $workspace: The workspace entity to get the workspace pointer for.

Return value

\Drupal\workspace\WorkspacePointerInterface The workspace pointer for the given workspace.

5 calls to WorkspacePointer::loadFromWorkspace()
ReplicationSettingsPageTest::testReplicationConfigurationForms in tests/src/Functional/ReplicationSettingsPageTest.php
Test the forms.
ReplicatorTest::testSelectiveContentReplication in tests/src/Functional/ReplicatorTest.php
Test selective content replication.
WorkspaceController::getDefaultWorkspacePointer in src/Controller/WorkspaceController.php
Returns the upstream for the given workspace.
WorkspaceTestUtilities::getPointerToWorkspace in tests/src/Functional/WorkspaceTestUtilities.php
Returns a pointer to the specified workspace.
workspace_multiversion_workspace_predelete in ./workspace.module
Implements hook_multiversion_workspace_predelete().

File

src/Entity/WorkspacePointer.php, line 240

Class

WorkspacePointer
Defines the Workspace pointer entity.

Namespace

Drupal\workspace\Entity

Code

public static function loadFromWorkspace(WorkspaceInterface $workspace) {
  $pointers = \Drupal::service('entity_type.manager')
    ->getStorage('workspace_pointer')
    ->loadByProperties([
    'workspace_pointer' => $workspace
      ->id(),
  ]);
  return reset($pointers);
}