public function InsertPosition::performInsert in Entity Reference Hierarchy 8.2
Same name and namespace in other branches
- 3.x src/Storage/InsertPosition.php \Drupal\entity_hierarchy\Storage\InsertPosition::performInsert()
Perform the insert.
Parameters
\Drupal\entity_hierarchy\Storage\NestedSetStorage $storage: Storage.
\PNX\NestedSet\Node|\PNX\NestedSet\NodeKey $node: Node to create or insert.
Return value
\PNX\NestedSet\Node Inserted node.
File
- src/
Storage/ InsertPosition.php, line 66
Class
- InsertPosition
- Defines a value object for an insert position.
Namespace
Drupal\entity_hierarchy\StorageCode
public function performInsert(NestedSetStorage $storage, $node) {
$command = [
'action' => self::ACTION_ADD_NODE,
'direction' => $this->direction,
];
if (!$this->insert) {
$command['action'] = self::ACTION_MOVE_SUB_TREE;
}
$method = implode('', $command);
return call_user_func_array([
$storage,
$method,
], [
$this->reference,
$node,
]);
}