Trait DashboardTrait
Methods summary
protected
Charcoal\Ui\Dashboard\DashboardInterface
|
#
setWidgetBuilder( object $builder )
Set a widget builder.
Parameters
- $builder
- The builder to create customized widget objects.
Returns
Throws
InvalidArgumentException If the argument is not a widget builder.
|
public
Charcoal\Ui\Dashboard\DashboardInterface
|
#
setWidgetCallback( callable|null $callable )
Set a callback to be applied to each widget output by self::widgets().
Parameters
- $callable
A callback to be applied to each widget
or NULL to disable the callback.
Returns
Throws
InvalidArgumentException If the argument is not callable or NULL.
|
public
Charcoal\Ui\Dashboard\DashboardInterface
|
#
setWidgets( array $widgets )
Set the dashboard's widgets.
Set the dashboard's widgets.
Parameters
- $widgets
- A collection of widgets.
Returns
|
public
Charcoal\Ui\Dashboard\DashboardInterface
|
#
addWidget( string $widgetIdent, Charcoal\Ui\UiItemInterface |array $widget )
Add a widget to the dashboard.
Add a widget to the dashboard.
If a widget with the same $widgetIdent already exists, it will be overridden.
Parameters
- $widgetIdent
- The widget identifier.
- $widget
- The widget object or structure.
Returns
Throws
InvalidArgumentException If the widget is invalid.
|
public
Charcoal\Ui\UiItemInterface[] |Generator
|
#
widgets( callable $widgetCallback = null )
Retrieve the dashboard's widgets.
Retrieve the dashboard's widgets.
Parameters
- $widgetCallback
- A callback applied to each widget.
Returns
|
public
boolean
|
#
hasWidgets( )
Determine if the dashboard has any widgets.
Determine if the dashboard has any widgets.
Returns
boolean
|
public
integer
|
#
numWidgets( )
Count the number of widgets attached to the dashboard.
Count the number of widgets attached to the dashboard.
Returns
integer
|
protected static
integer
|
#
sortWidgetsByPriority( mixed $a, mixed $b )
Static comparison function used by uasort().
Static comparison function used by uasort().
Parameters
- $a
- Widget A.
- $b
- Widget B.
Returns
integer Sorting value: -1 or 1
|
Properties summary
protected
object
|
$widgetBuilder
Store a widget builder instance.
Store a widget builder instance.
|
|