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