Skip to content

Commit

Permalink
fix: open element when adding new item to it
Browse files Browse the repository at this point in the history
  • Loading branch information
Severin Hauser committed Mar 28, 2023
1 parent 1f9cf97 commit 57bbd82
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/TreeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,17 @@ public function add($request)
$item->Children()->Add($child, $sortArr);
$item->write();

// Make sure we can see the child (an its children)
$this->openRecursive($child, [$item]);
// Make sure we can see the child (and its children)
if ($existing) {
$this->openRecursive($child, [$item]);
} else {
$this->openItem(array_merge($path, [$item->ID]));
}
} else {
if ($existing) {
$child->write();
$this->openRecursive($child);
} else {
$child->write();
}
$this->getItems()->Add($child, $sortArr);
}
Expand Down

0 comments on commit 57bbd82

Please sign in to comment.