diff --git a/docs/customizing-templates.rst b/docs/customizing-templates.rst index 64de5b95..51c24b21 100644 --- a/docs/customizing-templates.rst +++ b/docs/customizing-templates.rst @@ -215,30 +215,6 @@ title for any of the fields by using the ``scaffold.fields`` configuration } } -Disabling the Sidebar ---------------------- - -There are cases where you may wish to disable the sidebar. For instance, you -may be implementing crud-view for just a single table, or have all navigation -in your header. You can disable it using the ``scaffold.disable_sidebar`` -configuration key: - - -.. code-block:: php - - Crud->action(); - $action->config('scaffold.disable_sidebar', false); - } - } - Overriding Template Parts ------------------------- diff --git a/src/Listener/Traits/SidebarNavigationTrait.php b/src/Listener/Traits/SidebarNavigationTrait.php index 31c7116e..4616378b 100644 --- a/src/Listener/Traits/SidebarNavigationTrait.php +++ b/src/Listener/Traits/SidebarNavigationTrait.php @@ -14,7 +14,9 @@ trait SidebarNavigationTrait public function beforeRenderSidebarNavigation(Event $event) { $controller = $this->_controller(); - $controller->set('sidebarNavigation', $this->_getSidebarNavigation()); + $sidebarNavigation = $this->_getSidebarNavigation(); + $controller->set('disableSidebar', ($sidebarNavigation === false) ? true : false); + $controller->set('sidebarNavigation', $sidebarNavigation); } /** @@ -26,6 +28,11 @@ protected function _getSidebarNavigation() { $action = $this->_action(); + // deprecated check + if ($action->config('scaffold.disable_sidebar')) { + return false; + } + return $action->config('scaffold.sidebar_navigation'); } } diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index 11553f82..7f9accc3 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -94,7 +94,6 @@ public function beforeRender(Event $event) $controller->set('viewblocks', $this->_getViewBlocks()); $controller->set('formUrl', $this->_getFormUrl()); $controller->set('disableExtraButtons', $this->_getDisableExtraButtons()); - $controller->set('disableSidebar', $this->_getDisableSidebar()); $controller->set('extraButtonsBlacklist', $this->_getExtraButtonsBlacklist()); $controller->set('enableDirtyCheck', $this->_getEnableDirtyCheck()); $controller->set('actionGroups', $this->_getActionGroups()); @@ -590,18 +589,6 @@ protected function _getDisableExtraButtons() return $action->config('scaffold.disable_extra_buttons') ?: false; } - /** - * Disable sidebar. - * - * @return bool - */ - protected function _getDisableSidebar() - { - $action = $this->_action(); - - return $action->config('scaffold.disable_sidebar') ?: false; - } - /** * Get extra buttons blacklist *