diff --git a/src/Widgets/WidgetPageExtension.php b/src/Widgets/WidgetPageExtension.php index 81de266..31d0435 100755 --- a/src/Widgets/WidgetPageExtension.php +++ b/src/Widgets/WidgetPageExtension.php @@ -8,6 +8,7 @@ use SilverStripe\Forms\LiteralField; use SilverStripe\Widgets\Forms\WidgetAreaEditor; use SilverStripe\Widgets\Model\Widget; use SilverStripe\Widgets\Model\WidgetArea; +use SilverStripe\Forms\CheckboxField; /** * Class \A2nt\CMSNiceties\Widgets\WidgetPageExtension @@ -16,6 +17,10 @@ use SilverStripe\Widgets\Model\WidgetArea; */ class WidgetPageExtension extends \SilverStripe\Widgets\Extensions\WidgetPageExtension { + private static $db = [ + 'DisableSidebar' => 'Boolean(0)', + ]; + public function updateCMSFields(FieldList $fields) { parent::updateCMSFields($fields); @@ -23,8 +28,8 @@ class WidgetPageExtension extends \SilverStripe\Widgets\Extensions\WidgetPageExt $tab = $fields->findOrMakeTab('Root.Widgets'); $tab->setTitle('Sidebar'); - $tab->removeByName('SideBar'); + $tab->push(CheckboxField::create('DisableSidebar')); $widgetTypes = WidgetAreaEditor::create('Sidebar')->AvailableWidgets(); $available = []; diff --git a/templates/Includes/MainContent.ss b/templates/Includes/MainContent.ss index e014d4a..a86bb5e 100755 --- a/templates/Includes/MainContent.ss +++ b/templates/Includes/MainContent.ss @@ -7,7 +7,7 @@ <% end_if %> - <% if $SideBarContent || $SideBarView && $SideBarView.Widgets.Count %> + <% if not $DisableSidebar && $SideBarContent || $SideBarView && $SideBarView.Widgets.Count %>