mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
IMPR: Allow to disable sidebar
This commit is contained in:
parent
425c236f5f
commit
03dba051bc
@ -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 = [];
|
||||
|
@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<% end_if %>
|
||||
|
||||
<% if $SideBarContent || $SideBarView && $SideBarView.Widgets.Count %>
|
||||
<% if not $DisableSidebar && $SideBarContent || $SideBarView && $SideBarView.Widgets.Count %>
|
||||
<div class="content-holder content-holder__sidebar">
|
||||
<div class="{$DefaultContainer}">
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user