'Boolean', ); static $defaults = array( 'InheritSideBar' => true ); static $has_one = array( 'SideBar' => 'WidgetArea' ); function updateCMSFields(FieldList $fields) { $fields->addFieldToTab( "Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent') ); $fields->addFieldToTab( "Root.Widgets", new WidgetAreaEditor("SideBar") ); } /** * @return WidgetArea */ function SideBarView() { if( $this->owner->InheritSideBar && $this->owner->getParent() && $this->owner->getParent()->hasMethod('SideBar') ) { return $this->owner->getParent()->SideBar(); } elseif($this->owner->SideBar()->exists()){ return $this->owner->SideBar(); } } }