Properties

$ident

$ident : string

Type

string

$label

$label : \Charcoal\Translator\Translation|null

Type

\Charcoal\Translator\Translation|null

$url

$url : string

Type

string

$childCallback

$childCallback : callable

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.

setItemCallback()

setItemCallback(callable  $cb) : \Charcoal\Ui\MenuItem\MenuItemInterface

Parameters

callable $cb

The item callback.

Returns

\Charcoal\Ui\MenuItem\MenuItemInterface

Chainable

setIdent()

setIdent(string  $ident) : \Charcoal\Ui\MenuItem\MenuItem

Parameters

string $ident

The menu item identifier.

Throws

\InvalidArgumentException

If the identifier argument is not a string.

Returns

\Charcoal\Ui\MenuItem\MenuItem —

Chainable

ident()

ident() : string

Returns

string

setLabel()

setLabel(mixed  $label) : \Charcoal\Ui\MenuItem\MenuItem

Parameters

mixed $label

The menu item label.

Returns

\Charcoal\Ui\MenuItem\MenuItem —

Chainable

label()

label() : string

Returns

string

setUrl()

setUrl(string  $url) : \Charcoal\Ui\MenuItem\MenuItem

Parameters

string $url

The menu item URL.

Returns

\Charcoal\Ui\MenuItem\MenuItem —

Chainable

url()

url() : string

Returns

string

hasUrl()

hasUrl() : boolean

Returns

boolean

setChildren()

setChildren(array  $children) : \Charcoal\Ui\MenuItem\MenuItem

Parameters

array $children

The menu item children items structure.

Returns

\Charcoal\Ui\MenuItem\MenuItem —

Chainable

addChild()

addChild(array|\Charcoal\Ui\MenuItem\MenuItem  $child) : \Charcoal\Ui\MenuItem\MenuItem

Parameters

array|\Charcoal\Ui\MenuItem\MenuItem $child

The child menu structure or object.

Throws

\InvalidArgumentException

If the child is not a menu object or structure.

Returns

\Charcoal\Ui\MenuItem\MenuItem —

Chainable

children()

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

Children (menu item) generator

Parameters

callable $childCallback

Optional callback.

Returns

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

hasChildren()

hasChildren() : boolean

Returns

boolean

numChildren()

numChildren() : 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 item 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