You are here

public function AccessControlHierarchyBase::load in Workbench Access 8

Loads a hierarchy definition for a single item in the tree.

Parameters

string $id: The identifier for the item, such as a term id.

Return value

\Drupal\workbench_access\AccessControlHierarchyInterface A plugin implementation.

Overrides AccessControlHierarchyInterface::load

File

src/AccessControlHierarchyBase.php, line 175

Class

AccessControlHierarchyBase
Defines a base hierarchy class that others may extend.

Namespace

Drupal\workbench_access

Code

public function load($id) {

  // This cache is specific to the object being called.
  // e.g. Drupal\workbench_access\Plugin\AccessControlHierarchy\Menu
  if (!isset($this->tree)) {
    $this->tree = $this
      ->getTree();
  }
  foreach ($this->tree as $parent => $data) {
    if (isset($data[$id])) {
      return $data[$id];
    }
  }
}