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