You are here

public function WorkspaceRepository::getDescendantsAndSelf in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workspaces/src/WorkspaceRepository.php \Drupal\workspaces\WorkspaceRepository::getDescendantsAndSelf()
  2. 10 core/modules/workspaces/src/WorkspaceRepository.php \Drupal\workspaces\WorkspaceRepository::getDescendantsAndSelf()

Returns the descendant IDs of the passed-in workspace, including itself.

Parameters

string $workspace_id: A workspace ID.

Return value

string[] An array of descendant workspace IDs, including the passed-in one.

Overrides WorkspaceRepositoryInterface::getDescendantsAndSelf

File

core/modules/workspaces/src/WorkspaceRepository.php, line 137

Class

WorkspaceRepository
Provides the default workspace tree lookup operations.

Namespace

Drupal\workspaces

Code

public function getDescendantsAndSelf($workspace_id) {
  return array_merge([
    $workspace_id,
  ], $this
    ->loadTree()[$workspace_id]['descendants']);
}