Generic widget container
- Author
- Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL 2 or later
- Since
- 3.1
◆ __construct()
◆ addWidget()
addWidget |
( |
Widget |
$widget, |
|
|
|
$index = null |
|
) |
| |
Add a widget to the container.
W of Widget
- Parameters
-
W | $widget | The actual widget |
String | $index | Optional index/name of the widget, defaults to class name without "widget" |
- Returns
- W The added widget to allow for easier handling
◆ countWidgets()
countWidgets |
( |
string |
$widget_class = null | ) |
|
Returns the number of widgets in this container. Optionally constrained to widgets of a specific class.
- Parameters
-
string | null | $widget_class | |
- Returns
- int
◆ Get()
Returns the instance of this container to ensure there is only one instance.
- Returns
- WidgetContainer The container instance
◆ getWidget()
Retrieve the widget at the specified position.
- Parameters
-
String | $index | Index/name of the widget to retrieve. |
- Returns
- WidgetElement The widget at the specified position.
- Exceptions
-
Exception | if the specified position is invalid |
◆ getWidgets()
Returns all widgets of the container.
- Returns
- array of Widget
◆ hasWidget()
Returns whether a widget exists at the given index.
- Parameters
-
String | $index | Index/name of the widget to check for. |
- Returns
- bool Does a widget exist at the given index?
◆ hasWidgets()
Returns whether this container has any widget.
- Returns
- bool True if the container has at least one widget, false otherwise.
◆ insertWidget()
insertWidget |
( |
Widget |
$widget, |
|
|
|
$before_index, |
|
|
|
$index = null |
|
) |
| |
Insert a widget before a specific other widget or at the end of the list if the specified position is invalid.
- Parameters
-
Widget | $widget | The actual widget |
String | $before_index | Insert widget before this widget |
String | $index | Optional index/name of the widget, defaults to class name without "widget" |
- Returns
- Widget The inserted widget to allow for easier handling
◆ removeWidget()
Removes the widget at the specified position.
- Parameters
-
String | $index | Index/name of the widget to remove. |
- Exceptions
-
Exception | if the specified position is invalid |
◆ render()
◆ $instances
The singleton instance of the container
◆ $widgets
Contains the widgets of the container
The documentation for this class was generated from the following file: