function WorkspacesMenuTreeStorage::loadTreeData

Same name in other branches
  1. 10 core/modules/workspaces/src/WorkspacesMenuTreeStorage.php \Drupal\workspaces\WorkspacesMenuTreeStorage::loadTreeData()

Overrides MenuTreeStorage::loadTreeData

File

core/modules/workspaces/src/WorkspacesMenuTreeStorage.php, line 55

Class

WorkspacesMenuTreeStorage
Overrides the default menu storage to provide workspace-specific menu links.

Namespace

Drupal\workspaces

Code

public function loadTreeData($menu_name, MenuTreeParameters $parameters) {
    // Add the active workspace as a menu tree condition parameter in order to
    // include it in the cache ID.
    if ($active_workspace = $this->workspaceManager
        ->getActiveWorkspace()) {
        $parameters->conditions['workspace'] = $active_workspace->id();
    }
    return parent::loadTreeData($menu_name, $parameters);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.