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