Widgets
in package
Widget management class.
Tags
Table of Contents
Properties
- $_cache : Cache
- $_db : DB
- $_enabled : array<string|int, mixed>
- $_language : Language
- $_name : string
- $_template : TemplateBase
- $_widgets : array<string|int, AbstractWidget>
Methods
- __construct() : mixed
- add() : void
- Register a widget to the widget list.
- disable() : void
- Disable a widget.
- enable() : void
- Enable a widget.
- getAll() : array<string|int, AbstractWidget>
- List all widgets, sorted by their order.
- getName() : string
- Get the name of this collection of widgets.
- getWidget() : AbstractWidget|null
- Get a widget by name.
- getWidgets() : array<string|int, mixed>
- Get code for all enabled widgets on the current page.
- isEnabled() : bool
- Check if widget is enabled or not.
Properties
$_cache
private
Cache
$_cache
$_db
private
DB
$_db
$_enabled
private
array<string|int, mixed>
$_enabled
= []
$_language
private
Language
$_language
$_name
private
string
$_name
$_template
private
TemplateBase
$_template
$_widgets
private
array<string|int, AbstractWidget>
$_widgets
= []
Methods
__construct()
public
__construct(Cache $cache, Language $language, TemplateBase $template[, string $name = 'core' ]) : mixed
Parameters
- $cache : Cache
- $language : Language
- $template : TemplateBase
- $name : string = 'core'
add()
Register a widget to the widget list.
public
add(AbstractWidget $widget) : void
Parameters
- $widget : AbstractWidget
-
Instance of widget to register.
disable()
Disable a widget.
public
disable(AbstractWidget $widget) : void
Parameters
- $widget : AbstractWidget
-
Instance of widget to disable.
enable()
Enable a widget.
public
enable(AbstractWidget $widget) : void
Parameters
- $widget : AbstractWidget
-
Instance of widget to enable.
getAll()
List all widgets, sorted by their order.
public
getAll() : array<string|int, AbstractWidget>
Return values
array<string|int, AbstractWidget> —List of widgets.
getName()
Get the name of this collection of widgets.
public
getName() : string
Not used internally.
Return values
string —Name of this instance.
getWidget()
Get a widget by name.
public
getWidget(string $name) : AbstractWidget|null
Parameters
- $name : string
-
Name of widget to get.
Return values
AbstractWidget|null —Instance of widget with same name, null if it doesn't exist.
getWidgets()
Get code for all enabled widgets on the current page.
public
getWidgets(string $location[, User|null $profile_user = null ]) : array<string|int, mixed>
Parameters
- $location : string
-
Either
left
orright
. - $profile_user : User|null = null
-
User object of the profile page.
Return values
array<string|int, mixed> —List of HTML to be displayed.
isEnabled()
Check if widget is enabled or not.
public
isEnabled(AbstractWidget $widget) : bool
Parameters
- $widget : AbstractWidget
-
Instance of widget to check.
Return values
bool —Whether this widget is enabled or not.