mirror of
https://github.com/a2nt/cms-niceties.git
synced 2024-10-22 11:05:46 +02:00
IMPR: Allow moving Sidebar into elements list
This commit is contained in:
parent
0019e3e6fd
commit
c0cf1c72c1
@ -44,8 +44,20 @@ class SiteTreeExtension extends DataExtension
|
|||||||
public function ShowSidebar()
|
public function ShowSidebar()
|
||||||
{
|
{
|
||||||
$obj = $this->owner;
|
$obj = $this->owner;
|
||||||
|
$area = $obj->ElementalArea();
|
||||||
|
if(!$area) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$els = $area->Elements();
|
||||||
|
if(!$els) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$els = $els->find('ClassName', SidebarElement::class);
|
||||||
|
if(!$els) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if ($obj->ElementalArea()->Elements()->find('ClassName', SidebarElement::class)->first()) {
|
if ($els->first()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user