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