You are here

protected function QueryTrait::getWorkspaceId in Multiversion 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Query/QueryTrait.php \Drupal\multiversion\Entity\Query\QueryTrait::getWorkspaceId()

Helper method to get the workspace ID to query.

1 call to QueryTrait::getWorkspaceId()
QueryTrait::prepare in src/Entity/Query/QueryTrait.php

File

src/Entity/Query/QueryTrait.php, line 82

Class

QueryTrait
@property $entityTypeId @property $entityTypeManager @property $condition

Namespace

Drupal\multiversion\Entity\Query

Code

protected function getWorkspaceId() {
  if ($this->workspaceId) {
    return $this->workspaceId;
  }
  if ($workspace = \Drupal::service('workspace.manager')
    ->getActiveWorkspace()) {
    return $workspace
      ->id();
  }
  return NULL;
}