Skip to content
Snippets Groups Projects
Commit cec0fa91 authored by David Siegfried's avatar David Siegfried Committed by André Noack
Browse files

render template widget correctly, fixes #1115, re #1102

Merge request studip/studip!666
parent 15779b85
No related branches found
No related tags found
No related merge requests found
...@@ -116,12 +116,7 @@ class ResourceTreeWidget extends SidebarWidget ...@@ -116,12 +116,7 @@ class ResourceTreeWidget extends SidebarWidget
$variables['max_open_depth'] = 0; $variables['max_open_depth'] = 0;
$variables['layout_css_classes'] = $this->layout_css_classes; $variables['layout_css_classes'] = $this->layout_css_classes;
$template = $GLOBALS['template_factory']->open( return parent::render($variables);
$this->template
);
$template->set_attributes($variables);
$template->set_layout('sidebar/widget-layout');
return $template->render();
} }
public function setCurrentResource(Resource $resource) public function setCurrentResource(Resource $resource)
......
...@@ -11,12 +11,32 @@ class SidebarWidget extends Widget ...@@ -11,12 +11,32 @@ class SidebarWidget extends Widget
{ {
protected $additional_attributes = []; protected $additional_attributes = [];
public function __construct() public function __construct()
{ {
$this->layout = 'sidebar/widget-layout.php'; $this->layout = 'sidebar/widget-layout.php';
} }
/**
* Sets the ID of the HTML element that represents the widget.
*
* @param $id The element-ID to be used for the widget.
*
*/
public function setId(string $id)
{
$this->id = $id;
}
/**
* Returns the ID of this widget, if it is set.
*
* @return string The ID of the widget or an empty string, if it is not set.
*/
public function getId() : string
{
return $this->id ?? '';
}
/** /**
* Sets the title of the widget. * Sets the title of the widget.
* *
...@@ -77,7 +97,6 @@ class SidebarWidget extends Widget ...@@ -77,7 +97,6 @@ class SidebarWidget extends Widget
unset($this->additional_attributes[$key]); unset($this->additional_attributes[$key]);
} }
/** /**
* Renders the widget. * Renders the widget.
* The widget will only be rendered if it contains at least one element. * The widget will only be rendered if it contains at least one element.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment