From 3ee2ec86f8f177b7f76348669496ee83382a6c28 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Mon, 15 Feb 2016 17:58:30 +1100 Subject: [PATCH] Allow toolbarButtons: false --- .../backend/behaviors/RelationController.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/backend/behaviors/RelationController.php b/modules/backend/behaviors/RelationController.php index e9431dbe7..537e01983 100644 --- a/modules/backend/behaviors/RelationController.php +++ b/modules/backend/behaviors/RelationController.php @@ -501,7 +501,7 @@ class RelationController extends ControllerBehavior */ $defaultButtons = null; - if (!$this->readOnly) { + if (!$this->readOnly && $this->toolbarButtons) { $defaultButtons = '~/modules/backend/behaviors/relationcontroller/partials/_toolbar.htm'; } @@ -1287,10 +1287,16 @@ class RelationController extends ControllerBehavior */ protected function evalToolbarButtons() { - if ($buttons = $this->getConfig('view[toolbarButtons]')) { - return is_array($buttons) - ? $buttons - : array_map('trim', explode('|', $buttons)); + $buttons = $this->getConfig('view[toolbarButtons]'); + + if ($buttons === false) { + return null; + } + elseif (is_string($buttons)) { + return array_map('trim', explode('|', $buttons)); + } + elseif (is_array($buttons)) { + return $buttons; } switch ($this->relationType) { @@ -1430,5 +1436,4 @@ class RelationController extends ControllerBehavior return $this->makeConfig($config); } - }