Allow toolbarButtons: false

This commit is contained in:
Samuel Georges 2016-02-15 17:58:30 +11:00
parent 049e5bcfc7
commit 3ee2ec86f8
1 changed files with 11 additions and 6 deletions

View File

@ -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);
}
}