/** * Insert node before or after another node. * * @param Node $node * @param bool $after * * @return bool */ protected function actionBeforeOrAfter(Node $node, $after = false) { $node->refreshNode(); return $this->insertAt($after ? $node->getRgt() + 1 : $node->getLft()); }
/** * Insert node before or after another node. * * @param Node $node * @param bool $after * * @return bool */ protected function actionBeforeOrAfter(Node $node, $after = false) { if (!$node->exists) { throw new LogicException('Cannot insert before/after non-existing node.'); } if ($this->getParentId() != $node->getParentId()) { $this->setParent($node->getAttribute('parent')); } $node->refreshNode(); return $this->insertAt($after ? $node->getRgt() + 1 : $node->getLft()); }