/** * this method renders the output for all widgetsets and returns it * if the current page has no widgetset for the actual area, has a parent * and the option InheritFromParent is set it will recursively render the * parent widgetsets * * @param Page $pageToLoadFrom Parent page to load the widgets from * @param string $identifier Identifier of the widget set to load * * @author Patrick Schneider <*****@*****.**> * @since 30.01.2013 */ public function getWidgetSetsFromParent($pageToLoadFrom, $identifier) { $output = ''; $controllerName = 'WidgetSet' . $identifier; $pageToLoadFrom->registerWidgetSet($controllerName, $pageToLoadFrom->{$controllerName}()); $pageToLoadFrom->loadWidgetControllers(); $controller = $pageToLoadFrom->getRegisteredWidgetSetController($controllerName); if ((is_null($controller) || $controller->Count() == 0) && $pageToLoadFrom->ParentID > 0 && $pageToLoadFrom->InheritFromParent) { return $this->getWidgetSetsFromParent($pageToLoadFrom->Parent(), $identifier); } elseif (!is_null($controller) && $controller->Count() > 0) { $widgetAreaID = 0; foreach ($controller as $widget) { if ($widgetAreaID != $widget->ParentID) { if ($widgetAreaID > 0) { $output .= '</div>'; } $output .= '<div>'; $widgetAreaID = $widget->ParentID; } $output .= $widget->WidgetHolder(); } $output .= '</div>'; } return $output; }