@@ 731-754 (lines=24) @@ | ||
728 | * @param bool $append |
|
729 | * @throws Exception |
|
730 | */ |
|
731 | protected function insertIntoInternal($append) |
|
732 | { |
|
733 | $this->checkNode(false); |
|
734 | $item = $this->owner->getAttribute($this->itemAttribute); |
|
735 | ||
736 | if ($item !== null) { |
|
737 | $path = $this->node->getAttribute($this->pathAttribute); |
|
738 | $this->owner->setAttribute($this->pathAttribute, $path . $this->delimiter . $item); |
|
739 | } |
|
740 | ||
741 | $this->owner->setAttribute($this->depthAttribute, $this->node->getAttribute($this->depthAttribute) + 1); |
|
742 | ||
743 | if ($this->treeAttribute !== null) { |
|
744 | $this->owner->setAttribute($this->treeAttribute, $this->node->getAttribute($this->treeAttribute)); |
|
745 | } |
|
746 | ||
747 | if ($this->sortable !== false) { |
|
748 | if ($append) { |
|
749 | $this->owner->moveLast(); |
|
750 | } else { |
|
751 | $this->owner->moveFirst(); |
|
752 | } |
|
753 | } |
|
754 | } |
|
755 | ||
756 | /** |
|
757 | * Insert operation internal handler |
|
@@ 761-784 (lines=24) @@ | ||
758 | * @param bool $forward |
|
759 | * @throws Exception |
|
760 | */ |
|
761 | protected function insertNearInternal($forward) |
|
762 | { |
|
763 | $this->checkNode(true); |
|
764 | $item = $this->owner->getAttribute($this->itemAttribute); |
|
765 | ||
766 | if ($item !== null) { |
|
767 | $path = $this->node->getParentPath(); |
|
768 | $this->owner->setAttribute($this->pathAttribute, $path . $this->delimiter . $item); |
|
769 | } |
|
770 | ||
771 | $this->owner->setAttribute($this->depthAttribute, $this->node->getAttribute($this->depthAttribute)); |
|
772 | ||
773 | if ($this->treeAttribute !== null) { |
|
774 | $this->owner->setAttribute($this->treeAttribute, $this->node->getAttribute($this->treeAttribute)); |
|
775 | } |
|
776 | ||
777 | if ($this->sortable !== false) { |
|
778 | if ($forward) { |
|
779 | $this->owner->moveAfter($this->node); |
|
780 | } else { |
|
781 | $this->owner->moveBefore($this->node); |
|
782 | } |
|
783 | } |
|
784 | } |
|
785 | ||
786 | /** |
|
787 | * @return int |