mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 15:05:54 +00:00
Merge pull request #93 from hailwood/patch-1
Support widget forms with InheritSidebar
This commit is contained in:
commit
17c94ff9ce
@ -29,9 +29,15 @@ class WidgetContentControllerExtension extends Extension {
|
||||
$SQL_id = $this->owner->getRequest()->param('ID');
|
||||
if(!$SQL_id) return false;
|
||||
|
||||
/** @var SiteTree $widgetOwner */
|
||||
$widgetOwner = $this->owner->data();
|
||||
while($widgetOwner->InheritSideBar && $widgetOwner->Parent()->exists()){
|
||||
$widgetOwner = $widgetOwner->Parent();
|
||||
}
|
||||
|
||||
// find WidgetArea relations
|
||||
$widgetAreaRelations = array();
|
||||
$hasOnes = $this->owner->data()->has_one();
|
||||
$hasOnes = $widgetOwner->has_one();
|
||||
|
||||
if(!$hasOnes) {
|
||||
return false;
|
||||
@ -51,7 +57,8 @@ class WidgetContentControllerExtension extends Extension {
|
||||
break;
|
||||
}
|
||||
|
||||
$widget = $this->owner->data()->$widgetAreaRelation()->Widgets(
|
||||
|
||||
$widget = $widgetOwner->$widgetAreaRelation()->Widgets(
|
||||
sprintf('"Widget"."ID" = %d', $SQL_id)
|
||||
)->First();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user