function entity_hierarchy_node_load in Entity Reference Hierarchy 8
Implements Here we're adding the parent's nid to the node object.
See also
hook_ENTITY_TYPE_load() for node entities.
File
- ./
entity_hierarchy.module, line 336 - A module to make nodes hierarchical.
Code
function entity_hierarchy_node_load($nodes) {
// $node = \Drupal::routeMatch()->getParameter('node');
// $current_nid = null;
// if ($node) {
// $current_nid = $node->id();
// dpm($current_nid);
// }
//// For now, we'll only deal with the current node's parent with the above code
//// foreach($nodes as $node) {
//// dpm($node->id());
//// }
// /** @var \Drupal\entity_hierarchy\HierarchyOutlineStorage $hierarchy_storage */
// $hierarchy_storage = \Drupal::service('entity_hierarchy.outline_storage');
// $parent = $hierarchy_storage->hierarchyGetParent($current_nid);
// $nodes[$current_nid['nid']]->hierarchy_parent = $parent;
// dpm($nodes);
}