public function HierarchyManager::hierarchySaveNode in Entity Reference Hierarchy 8
Process a list of entity_hierarchy parents in preparation for writing to the database. No permission checking is done here. Each parent is written individually using HierarchyManager::hierarchyRecordSave.
Parameters
\Drupal\node\NodeInterface $node: The node object containing the list of parents to process.
Overrides HierarchyManagerInterface::hierarchySaveNode
See also
HierarchyManager::hierarchyRecordSave
File
- src/
HierarchyManager.php, line 604 - Contains \Drupal\entity_hierarchy\HierarchyManager.
Class
- HierarchyManager
- Defines a hierarchy manager.
Namespace
Drupal\entity_hierarchyCode
public function hierarchySaveNode(&$node) {
if (!isset($node->entity_hierarchy_parents)) {
return;
}
foreach ($node->entity_hierarchy_parents as $i => $item) {
$node->entity_hierarchy_parents[$i] = (object) $item;
$node->entity_hierarchy_parents[$i]->cnid = (int) $node
->id();
if (!empty($node->entity_hierarchy_parents[$i]->remove)) {
$node->entity_hierarchy_parents[$i]->pnid = NULL;
}
$this
->hierarchyRecordSave($node->entity_hierarchy_parents[$i]);
}
}