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