Properties

$widgetBuilder

$widgetBuilder : object

Store a widget builder instance.

Type

object

$widgetCallback

$widgetCallback : callable

A callback applied to each widget output by {@see self::widgets()}.

Type

callable

$active

$active : boolean

A UI item is active by default.

Type

boolean

$type

$type : string|null

The UI item type.

Type

string|null

$template

$template : string|null

The UI item's template.

Type

string|null

$title

$title : \Charcoal\Translator\Translation

The UI item's title.

Type

\Charcoal\Translator\Translation

$subtitle

$subtitle : \Charcoal\Translator\Translation

The UI item's sub-title.

Type

\Charcoal\Translator\Translation

$description

$description : \Charcoal\Translator\Translation

The UI item's description.

Type

\Charcoal\Translator\Translation

$notes

$notes : \Charcoal\Translator\Translation

The UI item's notes.

Type

\Charcoal\Translator\Translation

$showTitle

$showTitle : boolean

The title is displayed by default.

Type

boolean

$showSubtitle

$showSubtitle : boolean

The sub-title is displayed by default.

Type

boolean

$showDescription

$showDescription : boolean

The description is displayed by default.

Type

boolean

$showNotes

$showNotes : boolean

The notes are displayed by default.

Type

boolean

$showHeader

$showHeader : boolean

The header is displayed by default.

Type

boolean

$showFooter

$showFooter : boolean

The footer is displayed by default.

Type

boolean

$icon

$icon : string

The icon ident from font-awesome library

Type

string

Methods

__construct()

__construct(array|\ArrayAccess  $data = null) 

Return a new UI item.

Parameters

array|\ArrayAccess $data

The class depdendencies.

setWidgetCallback()

setWidgetCallback(callable|null  $callable) : \Charcoal\Ui\Dashboard\DashboardInterface

Set a callback to be applied to each widget output by {@see self::widgets()}.

Parameters

callable|null $callable

A callback to be applied to each widget or NULL to disable the callback.

Throws

\InvalidArgumentException

If the argument is not callable or NULL.

Returns

\Charcoal\Ui\Dashboard\DashboardInterface

Chainable

setWidgets()

setWidgets(array  $widgets) : \Charcoal\Ui\Dashboard\DashboardInterface

Set the dashboard's widgets.

Parameters

array $widgets

A collection of widgets.

Returns

\Charcoal\Ui\Dashboard\DashboardInterface

Chainable

addWidget()

addWidget(string  $widgetIdent, \Charcoal\Ui\UiItemInterface|array  $widget) : \Charcoal\Ui\Dashboard\DashboardInterface

Add a widget to the dashboard.

If a widget with the same $widgetIdent already exists, it will be overridden.

Parameters

string $widgetIdent

The widget identifier.

\Charcoal\Ui\UiItemInterface|array $widget

The widget object or structure.

Throws

\InvalidArgumentException

If the widget is invalid.

Returns

\Charcoal\Ui\Dashboard\DashboardInterface

Chainable

widgets()

widgets(callable  $widgetCallback = null) : array<mixed,\Charcoal\Ui\UiItemInterface>|\Charcoal\Ui\Dashboard\Generator

Retrieve the dashboard's widgets.

Parameters

callable $widgetCallback

A callback applied to each widget.

Returns

array<mixed,\Charcoal\Ui\UiItemInterface>|\Charcoal\Ui\Dashboard\Generator

hasWidgets()

hasWidgets() : boolean

Determine if the dashboard has any widgets.

Returns

boolean

numWidgets()

numWidgets() : integer

Count the number of widgets attached to the dashboard.

Returns

integer

setLayoutBuilder()

setLayoutBuilder(\Charcoal\Ui\Layout\LayoutBuilder  $builder) : \Charcoal\Ui\Layout\DashboardInterface

Parameters

\Charcoal\Ui\Layout\LayoutBuilder $builder

The layout builder, to create customized layout object(s).

Returns

\Charcoal\Ui\Layout\DashboardInterface —

Chainable

setLayout()

setLayout(\Charcoal\Ui\Layout\LayoutInterface|array  $layout) : \Charcoal\Ui\Layout\DashboardInterface

Parameters

\Charcoal\Ui\Layout\LayoutInterface|array $layout

The layout object or structure.

Throws

\InvalidArgumentException

If the layout argument is not an object or layout structure.

Returns

\Charcoal\Ui\Layout\DashboardInterface —

Chainable

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Inject dependencies from a DI Container.

Parameters

\Pimple\Container $container

A dependencies container instance.

setActive()

setActive(boolean  $active) : \Charcoal\Ui\AbstractUiItem

Activates/deactivates the UI item.

Parameters

boolean $active

Activate (TRUE) or deactivate (FALSE) the UI item.

Returns

\Charcoal\Ui\AbstractUiItem

Chainable

active()

active() : boolean

Determine if the UI item is active.

Returns

boolean

setType()

setType(string|null  $type) : \Charcoal\Ui\UiItemInterface

Set the UI item type.

Parameters

string|null $type

The UI item type.

Throws

\InvalidArgumentException

If the type is not a string.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

type()

type() : string

Retrieve the dashboard type.

Returns

string

setTemplate()

setTemplate(string  $template) : \Charcoal\Ui\UiItemInterface

Set the UI item's template.

Usually, a path to a file containing the template to be rendered.

Parameters

string $template

A template (identifier).

Throws

\InvalidArgumentException

If the template is not a string.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

template()

template() : string

Retrieve the UI item's template.

Returns

string —

If unset, returns the UI item type.

setTitle()

setTitle(mixed  $title) : \Charcoal\Ui\UiItemInterface

Set the UI item's title.

Parameters

mixed $title

A title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

title()

title() : \Charcoal\Translator\Translation|null

Retrieve the title.

Returns

\Charcoal\Translator\Translation|null

setSubtitle()

setSubtitle(mixed  $subtitle) : \Charcoal\Ui\UiItemInterface

Set the UI item's sub-title.

Parameters

mixed $subtitle

A sub-title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

subtitle()

subtitle() : \Charcoal\Translator\Translation|null

Retrieve the sub-title.

Returns

\Charcoal\Translator\Translation|null

setDescription()

setDescription(mixed  $description) : \Charcoal\Ui\UiItemInterface

Set the UI item's description.

Parameters

mixed $description

A description.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

description()

description() : \Charcoal\Translator\Translation|null

Retrieve the description.

Returns

\Charcoal\Translator\Translation|null

setNotes()

setNotes(mixed  $notes) : \Charcoal\Ui\UiItemInterface

Set notes about the UI item.

Parameters

mixed $notes

Notes.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

notes()

notes() : \Charcoal\Translator\Translation|null

Retrieve the notes.

Returns

\Charcoal\Translator\Translation|null

setShowTitle()

setShowTitle(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's title.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showTitle()

showTitle() : boolean

Determine if the title is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a title.

setShowSubtitle()

setShowSubtitle(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's sub-title.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the sub-title.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showSubtitle()

showSubtitle() : boolean

Determine if the sub-title is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a sub-title.

setShowDescription()

setShowDescription(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's description.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the description.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showDescription()

showDescription() : boolean

Determine if the description is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a description.

setShowNotes()

setShowNotes(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's notes.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the notes.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showNotes()

showNotes() : boolean

Determine if the notes is to be displayed.

Returns

boolean —

If TRUE or unset, check if there are notes.

setShowHeader()

setShowHeader(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's header.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the header.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showHeader()

showHeader() : boolean

Determine if the header is to be displayed.

Returns

boolean —

If TRUE or unset, check if there is a title.

setShowFooter()

setShowFooter(boolean  $show) : \Charcoal\Ui\UiItemInterface

Show/hide the UI item's footer.

Parameters

boolean $show

Show (TRUE) or hide (FALSE) the footer.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

showFooter()

showFooter() : boolean

Determine if the footer is to be displayed.

Returns

boolean —

If TRUE or unset, check if there are notes.

icon()

icon() : string

Retrieve the path to the item's icon.

Returns

string

setIcon()

setIcon(string  $icon) : \Charcoal\Ui\UiItemInterface

Set the path to the item's icon associated with the object.

Parameters

string $icon

A path to an image.

Returns

\Charcoal\Ui\UiItemInterface

Chainable

setWidgetBuilder()

setWidgetBuilder(object  $builder) : \Charcoal\Ui\Dashboard\DashboardInterface

Set a widget builder.

Parameters

object $builder

The builder to create customized widget objects.

Throws

\InvalidArgumentException

If the argument is not a widget builder.

Returns

\Charcoal\Ui\Dashboard\DashboardInterface

Chainable

sortWidgetsByPriority()

sortWidgetsByPriority(mixed  $a, mixed  $b) : integer

Static comparison function used by {@see uasort()}.

Parameters

mixed $a

Widget A.

mixed $b

Widget B.

Returns

integer —

Sorting value: -1 or 1

translator()

translator() : \Charcoal\Translator\Translator

Returns

\Charcoal\Translator\Translator