You are here

public function HierarchyManager::hierarchyCanBeChild in Entity Reference Hierarchy 8

Overrides HierarchyManagerInterface::hierarchyCanBeChild

See also

hierarchyGetAllowedParentTypes

1 call to HierarchyManager::hierarchyCanBeChild()
HierarchyManager::hierarchyNodeParentFormItems in src/HierarchyManager.php
Build the parent form item for a given parent node object. This function is called iteratively in addHierarchyFormElement method to build a dropdown list of parents. We add a visible title (node title), the hierarchy id (hid), a parent node id (pid),…

File

src/HierarchyManager.php, line 198
Contains \Drupal\entity_hierarchy\HierarchyManager.

Class

HierarchyManager
Defines a hierarchy manager.

Namespace

Drupal\entity_hierarchy

Code

public function hierarchyCanBeChild(NodeInterface $node) {
  $type = is_object($node) ? $node
    ->getType() : $node;
  return count($this
    ->hierarchyGetAllowedParentTypes($type));
}