Skip to content

Commit

Permalink
fix(treeview): Fix setting value after constructor call not working
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco (Valandur) committed Dec 21, 2018
1 parent 2e27ad8 commit 883e493
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/TreeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,20 @@ public function __construct($name, $title = null, $section = null)
$this->section = $section;
$this->context = singleton(PageElement::class)->getDefaultSearchContext();

// Open default elements
$this->opens = new \stdClass();
foreach ($this->getItems() as $item) {
$this->openRecursive($item);
if ($section) {
// Open default elements
$this->opens = new \stdClass();
foreach ($this->getItems() as $item) {
$this->openRecursive($item);
}
}
}

public function setValue($value, $data = null) {
$this->section = $value;
return $this;
}

/**
* Saves this TreeView into the specified record
*
Expand Down Expand Up @@ -874,3 +881,5 @@ private function closeItem($path)
unset($opens->{$path[count($path) - 1]});
}
}

class TreeView_Readonly extends TreeView {}

0 comments on commit 883e493

Please sign in to comment.