| @@ 681-704 (lines=24) @@ | ||
| 678 | * @param bool $append |
|
| 679 | * @throws Exception |
|
| 680 | */ |
|
| 681 | protected function insertIntoInternal($append) |
|
| 682 | { |
|
| 683 | $this->checkNode(false); |
|
| 684 | $item = $this->owner->getAttribute($this->itemAttribute); |
|
| 685 | ||
| 686 | if ($item !== null) { |
|
| 687 | $path = $this->node->getAttribute($this->pathAttribute); |
|
| 688 | $this->owner->setAttribute($this->pathAttribute, $path . $this->delimiter . $item); |
|
| 689 | } |
|
| 690 | ||
| 691 | $this->owner->setAttribute($this->depthAttribute, $this->node->getAttribute($this->depthAttribute) + 1); |
|
| 692 | ||
| 693 | if ($this->treeAttribute !== null) { |
|
| 694 | $this->owner->setAttribute($this->treeAttribute, $this->node->getAttribute($this->treeAttribute)); |
|
| 695 | } |
|
| 696 | ||
| 697 | if ($this->sortable !== false) { |
|
| 698 | if ($append) { |
|
| 699 | $this->owner->moveLast(); |
|
| 700 | } else { |
|
| 701 | $this->owner->moveFirst(); |
|
| 702 | } |
|
| 703 | } |
|
| 704 | } |
|
| 705 | ||
| 706 | /** |
|
| 707 | * Insert operation internal handler |
|
| @@ 711-734 (lines=24) @@ | ||
| 708 | * @param bool $forward |
|
| 709 | * @throws Exception |
|
| 710 | */ |
|
| 711 | protected function insertNearInternal($forward) |
|
| 712 | { |
|
| 713 | $this->checkNode(true); |
|
| 714 | $item = $this->owner->getAttribute($this->itemAttribute); |
|
| 715 | ||
| 716 | if ($item !== null) { |
|
| 717 | $path = $this->node->getParentPath(); |
|
| 718 | $this->owner->setAttribute($this->pathAttribute, $path . $this->delimiter . $item); |
|
| 719 | } |
|
| 720 | ||
| 721 | $this->owner->setAttribute($this->depthAttribute, $this->node->getAttribute($this->depthAttribute)); |
|
| 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 ($forward) { |
|
| 729 | $this->owner->moveAfter($this->node); |
|
| 730 | } else { |
|
| 731 | $this->owner->moveBefore($this->node); |
|
| 732 | } |
|
| 733 | } |
|
| 734 | } |
|
| 735 | ||
| 736 | /** |
|
| 737 | * @return int |
|