Skip to content
Snippets Groups Projects
Commit c662a4c6 authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

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

Merge request studip/studip!666
parent 98231d32
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)
......
...@@ -9,16 +9,13 @@ ...@@ -9,16 +9,13 @@
*/ */
class SidebarWidget extends Widget class SidebarWidget extends Widget
{ {
protected $id = '';
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. * Sets the ID of the HTML element that represents the widget.
* *
...@@ -30,7 +27,6 @@ class SidebarWidget extends Widget ...@@ -30,7 +27,6 @@ class SidebarWidget extends Widget
$this->id = $id; $this->id = $id;
} }
/** /**
* Returns the ID of this widget, if it is set. * Returns the ID of this widget, if it is set.
* *
...@@ -38,7 +34,7 @@ class SidebarWidget extends Widget ...@@ -38,7 +34,7 @@ class SidebarWidget extends Widget
*/ */
public function getId() : string public function getId() : string
{ {
return $this->id; return $this->id ?? '';
} }
/** /**
...@@ -101,7 +97,6 @@ class SidebarWidget extends Widget ...@@ -101,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