aboutsummaryrefslogtreecommitdiff
path: root/lib/classes
diff options
context:
space:
mode:
Diffstat (limited to 'lib/classes')
-rw-r--r--lib/classes/sidebar/ResourceTreeWidget.class.php7
-rw-r--r--lib/classes/sidebar/SidebarWidget.php23
2 files changed, 22 insertions, 8 deletions
diff --git a/lib/classes/sidebar/ResourceTreeWidget.class.php b/lib/classes/sidebar/ResourceTreeWidget.class.php
index c99192e..75befd4 100644
--- a/lib/classes/sidebar/ResourceTreeWidget.class.php
+++ b/lib/classes/sidebar/ResourceTreeWidget.class.php
@@ -116,12 +116,7 @@ class ResourceTreeWidget extends SidebarWidget
$variables['max_open_depth'] = 0;
$variables['layout_css_classes'] = $this->layout_css_classes;
- $template = $GLOBALS['template_factory']->open(
- $this->template
- );
- $template->set_attributes($variables);
- $template->set_layout('sidebar/widget-layout');
- return $template->render();
+ return parent::render($variables);
}
public function setCurrentResource(Resource $resource)
diff --git a/lib/classes/sidebar/SidebarWidget.php b/lib/classes/sidebar/SidebarWidget.php
index 0e4cc5f..7075b8a 100644
--- a/lib/classes/sidebar/SidebarWidget.php
+++ b/lib/classes/sidebar/SidebarWidget.php
@@ -11,13 +11,33 @@ class SidebarWidget extends Widget
{
protected $additional_attributes = [];
-
public function __construct()
{
$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.
*
* @param String $title The title of the widget
@@ -77,7 +97,6 @@ class SidebarWidget extends Widget
unset($this->additional_attributes[$key]);
}
-
/**
* Renders the widget.
* The widget will only be rendered if it contains at least one element.