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