Properties

$itemCallback

$itemCallback : callable

A callback applied to each menu item output by {@see self::items()}.

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.

setMenuItemBuilder()

setMenuItemBuilder(\Charcoal\Ui\MenuItem\MenuItemBuilder  $menuItemBuilder) : \Charcoal\Ui\Menu\AsbtractMenu

Parameters

\Charcoal\Ui\MenuItem\MenuItemBuilder $menuItemBuilder

The Menu Item Builder that will be used to create new items.

Returns

\Charcoal\Ui\Menu\AsbtractMenu —

Chainable

setItemCallback()

setItemCallback(callable  $cb) : \Charcoal\Ui\Menu\AbstractMenu

Parameters

callable $cb

The item callback.

Returns

\Charcoal\Ui\Menu\AbstractMenu

Chainable

setItems()

setItems(array  $items) : \Charcoal\Ui\Menu\AbstractMenu

Parameters

array $items

The menu items.

Returns

\Charcoal\Ui\Menu\AbstractMenu

Chainable

addItem()

addItem(array|\Charcoal\Ui\MenuItem\MenuItemInterface  $item) : \Charcoal\Ui\Menu\MenuItem

Parameters

array|\Charcoal\Ui\MenuItem\MenuItemInterface $item

A menu item structure or object.

Throws

\InvalidArgumentException

If the item argument is not a structure or object.

Returns

\Charcoal\Ui\Menu\MenuItem —

Chainable

items()

items(callable  $itemCallback = null) : array<mixed,\Charcoal\Ui\MenuItem\MenuItemInterface>

Menu Item generator.

Parameters

callable $itemCallback

Optional. Item callback.

Returns

array<mixed,\Charcoal\Ui\MenuItem\MenuItemInterface>

hasItems()

hasItems() : boolean

Returns

boolean

numItems()

numItems() : integer

Returns

integer

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 menu 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

translator()

translator() : \Charcoal\Translator\Translator

Returns

\Charcoal\Translator\Translator