Skip to content

Commit

Permalink
fix(treeview): Fix treeview on archives page
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco (Valandur) committed Mar 12, 2019
1 parent be953b4 commit 3f85484
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/TreeView.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public function FieldHolder($properties = array())
'class' => 'treeview-pagesections pagesection-' . $this->getName(),
'data-readonly' => $this->readonly,
'data-name' => $this->getName(),
'data-url' => $this->Link(),
'data-url' => !$this->readonly ? $this->Link() : null,
'data-state-id' => $sessionId,
'data-allowed-elements' => json_encode($elems),
],
Expand Down Expand Up @@ -723,12 +723,6 @@ private function renderTree($item, $parents, $opens, $isFirst)
// There are two cases, either this GridField is on a page,
// or it is on a PageElement and we're looking at the children
$isAllowedRoot = in_array($item->ClassName, $parentClasses);

// Create the tree icon
$icon = '';
if ($item->Children() && $item->Children()->Count() > 0) {
$icon = ($isOpen === true ? 'font-icon-down-open' : 'font-icon-right-open');
}

// Create a button to add a new child element
// and save the allowed child classes on the button
Expand Down Expand Up @@ -796,7 +790,7 @@ private function renderTree($item, $parents, $opens, $isFirst)

// Create the tree icon
$icon = '';
if ($item->Children() && $item->Children()->Count() > 0) {
if (!$this->readonly && $item->Children() && $item->Children()->Count() > 0) {
$icon = ($isOpen === true ? 'font-icon-down-open' : 'font-icon-right-open');
}

Expand Down

0 comments on commit 3f85484

Please sign in to comment.