From 3f85484ea008e5602fcd609df5875869908c828d Mon Sep 17 00:00:00 2001 From: "Marco (Valandur)" Date: Tue, 12 Mar 2019 18:08:52 +0100 Subject: [PATCH] fix(treeview): Fix treeview on archives page --- src/TreeView.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/TreeView.php b/src/TreeView.php index 3bd9c57..bc1f25d 100644 --- a/src/TreeView.php +++ b/src/TreeView.php @@ -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), ], @@ -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 @@ -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'); }