\Charcoal\Admin\WidgetSidemenuWidget

Admin Sidemenu Widget

Summary

Methods
Properties
Constants
setDependencies()
setTemplate()
template()
setWidgetId()
widgetId()
setType()
type()
setIdent()
ident()
setDataSources()
dataSources()
dataSourceFilter()
setLabel()
label()
actions()
setShowActions()
showActions()
setShowLabel()
showLabel()
adminUrl()
setBaseUrl()
baseUrl()
setPriority()
priority()
setSidemenuGroupFactory()
setData()
hasSidemenu()
adminSidemenu()
objType()
setShowTitle()
showTitle()
setTitle()
title()
setLinks()
addLink()
links()
setDisplayType()
displayType()
displayAsPanel()
collapsible()
setDisplayOptions()
displayOptions()
defaultDisplayOptions()
parented()
collapsed()
setGroups()
addGroup()
groups()
defaultGroupType()
hasLinks()
numLinks()
hasGroups()
numGroups()
hasActions()
showSidemenuActions()
sidemenuActions()
jsActionPrefix()
$widgetId
DATA_SOURCE_REQUEST
DATA_SOURCE_OBJECT
DEFAULT_ACTION_PRIORITY
setModelFactory()
modelFactory()
addDataSources()
acceptedDataSources()
defaultDataSources()
defaultDataSourceFilters()
resolveDataSourceFilter()
mergeDataSources()
sidemenuGroupFactory()
sortGroupsByPriority()
setSidemenuActions()
createSidemenuActions()
defaultSidemenuActions()
$baseUrl
$adminConfig
$sidemenuActions
$defaultSidemenuActions
$parsedSidemenuActions
$displayType
$displayOptions
$title
$links
$groups
$sidemenuGroupFactory
N/A
No private methods found
$type
$template
$ident
$label
$lang
$showLabel
$showActions
$priority
$dataSources
$dataSourceFilters
$modelFactory
$collapsed
$parented
$showTitle
N/A

Constants

DATA_SOURCE_REQUEST

DATA_SOURCE_REQUEST

DATA_SOURCE_OBJECT

DATA_SOURCE_OBJECT

DEFAULT_ACTION_PRIORITY

DEFAULT_ACTION_PRIORITY

Default sorting priority for an action.

Properties

$widgetId

$widgetId : string

Type

string

$baseUrl

$baseUrl : \Psr\Http\Message\UriInterface|string

The base URI.

Type

\Psr\Http\Message\UriInterface|string

$adminConfig

$adminConfig : \Charcoal\Admin\Config

Store a reference to the admin configuration.

Type

\Charcoal\Admin\Config

$sidemenuActions

$sidemenuActions : array|null

Store the sidemenu actions.

Type

array|null

$defaultSidemenuActions

$defaultSidemenuActions : array|null

Store the default list actions.

Type

array|null

$parsedSidemenuActions

$parsedSidemenuActions : boolean

Keep track if sidemenu actions are finalized.

Type

boolean

$displayType

$displayType : string

The sidemenu's display type.

Type

string

$displayOptions

$displayOptions : array

The sidemenu's display options.

Type

array

$title

$title : string

The sidemenu's title.

Type

string

$links

$links : array

The sidemenu's links.

Type

array

$sidemenuGroupFactory

$sidemenuGroupFactory : \Charcoal\Factory\FactoryInterface

Store the factory instance for the current class.

Type

\Charcoal\Factory\FactoryInterface

$type

$type : string

Type

string

$template

$template : string

Type

string

$ident

$ident : string

Type

string

$label

$label : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$lang

$lang : string

Type

string

$showLabel

$showLabel : boolean

Type

boolean

$showActions

$showActions : boolean

Type

boolean

$priority

$priority : integer

Type

integer

$dataSources

$dataSources : array

Extra data sources to merge when setting data on an entity.

Type

array

$dataSourceFilters

$dataSourceFilters : array

Associative array of source identifiers and options to apply when merging.

Type

array

$modelFactory

$modelFactory : \Charcoal\Factory\FactoryInterface

Type

\Charcoal\Factory\FactoryInterface

$collapsed

$collapsed : boolean

Whether the group is collapsed or not.

Type

boolean

$parented

$parented : boolean

Whether the group has siblings or not.

Type

boolean

$showTitle

$showTitle : boolean

The title is displayed by default.

Type

boolean

Methods

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Inject dependencies from a DI Container.

Parameters

\Pimple\Container $container

A dependencies container instance.

setTemplate()

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

Parameters

string $template

The UI item's template (identifier).

Throws

\InvalidArgumentException

If the template identifier is not a string.

Returns

\Charcoal\Admin\UiItemInterface —

Chainable

template()

template() : string

Returns

string

setWidgetId()

setWidgetId(string  $widgetId) : \Charcoal\Admin\AdminWidget

Parameters

string $widgetId

The widget identifier.

Returns

\Charcoal\Admin\AdminWidget

Chainable

widgetId()

widgetId() : string

Returns

string

setType()

setType(string  $type) : \Charcoal\Admin\AdminWidget

Parameters

string $type

The widget type.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Admin\AdminWidget

Chainable

type()

type() : string

Returns

string

setIdent()

setIdent(string  $ident) : \Charcoal\Admin\AdminWidget

Parameters

string $ident

The widget ident.

Throws

\InvalidArgumentException

If the ident is not a string.

Returns

\Charcoal\Admin\AdminWidget

(Chainable)

ident()

ident() : string

Returns

string

setDataSources()

setDataSources(mixed  $sources) : \Charcoal\Admin\AdminWidget

Set extra data sources to merge when setting data on an entity.

Parameters

mixed $sources

One or more data source identifiers to merge data from. Pass NULL to reset the entity back to default sources. Pass FALSE, an empty string or array to disable extra sources.

Returns

\Charcoal\Admin\AdminWidget

Chainable

dataSources()

dataSources() : array<mixed,string>

Retrieve the extra data sources to merge when setting data on an entity.

Returns

array<mixed,string>

dataSourceFilter()

dataSourceFilter(string  $sourceIdent) : callable|null

Retrieve the callable filter for the given data source.

Parameters

string $sourceIdent

A data source identifier.

Throws

\InvalidArgumentException

If the data source is invalid.

Returns

callable|null —

Returns a callable variable.

setLabel()

setLabel(mixed  $label) : \Charcoal\Admin\AdminWidget

Parameters

mixed $label

The label.

Returns

\Charcoal\Admin\AdminWidget

Chainable

label()

label() : \Charcoal\Translator\Translation|string|null

Returns

\Charcoal\Translator\Translation|string|null

actions()

actions() : array

Returns

array

setShowActions()

setShowActions(boolean  $show) : \Charcoal\Admin\AdminWidget

Parameters

boolean $show

The show actions flag.

Returns

\Charcoal\Admin\AdminWidget

Chainable

showActions()

showActions() : boolean

Returns

boolean

setShowLabel()

setShowLabel(boolean  $show) : \Charcoal\Admin\AdminWidget

Parameters

boolean $show

The show label flag.

Returns

\Charcoal\Admin\AdminWidget

Chainable

showLabel()

showLabel() : boolean

Returns

boolean

adminUrl()

adminUrl() : \Psr\Http\Message\UriInterface|string

Retrieve the base URI of the administration area.

Returns

\Psr\Http\Message\UriInterface|string

setBaseUrl()

setBaseUrl(\Psr\Http\Message\UriInterface|string  $uri) : self

Set the base URI of the application.

Parameters

\Psr\Http\Message\UriInterface|string $uri

The base URI.

Returns

self

baseUrl()

baseUrl() : \Psr\Http\Message\UriInterface|string

Retrieve the base URI of the application.

Returns

\Psr\Http\Message\UriInterface|string

setPriority()

setPriority(integer  $priority) : \Charcoal\Admin\AdminWidget

Parameters

integer $priority

The widget's sorting priority.

Returns

\Charcoal\Admin\AdminWidget

Chainable

priority()

priority() : integer

Returns

integer

setSidemenuGroupFactory()

setSidemenuGroupFactory(\Charcoal\Factory\FactoryInterface  $factory) : self

Set an sidemenu group factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The group factory, to create objects.

Returns

self

setData()

setData(array  $data) : self

Parameters

array $data

Class data.

Returns

self

hasSidemenu()

hasSidemenu() : boolean

Determine if the sidemenu has anything.

Returns

boolean

adminSidemenu()

adminSidemenu() : array

Retrieve the metadata for the sidemenu.

Returns

array

objType()

objType() : string|null

Retrieve the current object type from the GET parameters.

Returns

string|null

setShowTitle()

setShowTitle(boolean  $show) : self

Show/hide the widget's title.

Parameters

boolean $show

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

Returns

self

showTitle()

showTitle() : boolean

Determine if the title is to be displayed.

Returns

boolean —

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

setTitle()

setTitle(mixed  $title) : self

Set the title of the sidemenu.

Parameters

mixed $title

A title for the sidemenu.

Returns

self

title()

title() : \Charcoal\Admin\Widget\Translation|null

Retrieve the title of the sidemenu.

Returns

\Charcoal\Admin\Widget\Translation|null

setLinks()

setLinks(array  $links) : self

Set the sidemenu links.

Parameters

array $links

A collection of link objects.

Returns

self

addLink()

addLink(string  $linkIdent, array|object  $link) : self

Set the sidemenu links.

Parameters

string $linkIdent

The link identifier.

array|object $link

The link object or structure.

Throws

\InvalidArgumentException

If the link is invalid.

Returns

self

links()

links() : array

Retrieve the sidemenu links.

Returns

array

setDisplayType()

setDisplayType(mixed  $type) : self

Set the display type of the sidemenu's contents.

Parameters

mixed $type

The display type.

Throws

\InvalidArgumentException

If the display type is invalid.

Returns

self

displayType()

displayType() : string|null

Retrieve the display type of the sidemenu's contents.

Returns

string|null

displayAsPanel()

displayAsPanel() : boolean

Determine if the sidemenu groups should be displayed as panels.

Returns

boolean

collapsible()

collapsible() : boolean

Determine if the display type is "collapsible".

Returns

boolean

setDisplayOptions()

setDisplayOptions(array  $options) : self

Set the display options for the sidemenu.

Parameters

array $options

Display configuration.

Throws

\InvalidArgumentException

If the display options are not an associative array.

Returns

self

displayOptions()

displayOptions() : array

Retrieve the display options for the sidemenu.

Throws

\RuntimeException

If the display options are not an associative array.

Returns

array

defaultDisplayOptions()

defaultDisplayOptions() : array

Retrieve the default display options for the sidemenu.

Returns

array

parented()

parented() : mixed

Returns

mixed

collapsed()

collapsed() : mixed

Returns

mixed

setGroups()

setGroups(array  $groups) : self

Set the sidemenu's groups.

Parameters

array $groups

A collection of group structures.

Returns

self

addGroup()

addGroup(string  $groupIdent, array|\Charcoal\Admin\Ui\Sidemenu\SidemenuGroupInterface  $group) : self

Add a sidemenu group.

Parameters

string $groupIdent

The group identifier.

array|\Charcoal\Admin\Ui\Sidemenu\SidemenuGroupInterface $group

The group object or structure.

Throws

\InvalidArgumentException

If the identifier is not a string or the group is invalid.

Returns

self

groups()

groups() : array<mixed,\Charcoal\Admin\Ui\Sidemenu\SidemenuGroupInterface>|\Charcoal\Admin\Widget\Generator

Retrieve the sidemenu groups.

Returns

array<mixed,\Charcoal\Admin\Ui\Sidemenu\SidemenuGroupInterface>|\Charcoal\Admin\Widget\Generator

defaultGroupType()

defaultGroupType() : string

Retrieve the default sidemenu group class name.

Returns

string

hasLinks()

hasLinks() : boolean

Determine if the sidemenu has any links.

Returns

boolean

numLinks()

numLinks() : integer

Count the number of sidemenu links.

Returns

integer

hasGroups()

hasGroups() : boolean

Determine if the sidemenu has any groups of links.

Returns

boolean

numGroups()

numGroups() : integer

Count the number of sidemenu groups.

Returns

integer

hasActions()

hasActions() : boolean

Alias for {@see self::showSidemenuActions()}

Returns

boolean

showSidemenuActions()

showSidemenuActions() : boolean

Determine if the sidemenu's actions should be shown.

Returns

boolean

sidemenuActions()

sidemenuActions() : array

Retrieve the sidemenu's actions.

Returns

array

jsActionPrefix()

jsActionPrefix() : string

Returns

string

setModelFactory()

setModelFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Admin\AdminScript

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory used to create models.

Returns

\Charcoal\Admin\AdminScript

Chainable

modelFactory()

modelFactory() : \Charcoal\Factory\FactoryInterface

Returns

\Charcoal\Factory\FactoryInterface —

The model factory.

addDataSources()

addDataSources(mixed  $sourceIdent, mixed  $sourceFilter = null) : \Charcoal\Admin\AdminWidget

Set extra data sources to merge when setting data on an entity.

Parameters

mixed $sourceIdent

The data source identifier.

mixed $sourceFilter

Optional filter to apply to the source's data.

Throws

\InvalidArgumentException

If the data source is invalid.

Returns

\Charcoal\Admin\AdminWidget

Chainable

acceptedDataSources()

acceptedDataSources() : array<mixed,string>

Retrieve the available data sources (when setting data on an entity).

Returns

array<mixed,string>

defaultDataSources()

defaultDataSources() : array<mixed,string>

Retrieve the default data sources (when setting data on an entity).

Returns

array<mixed,string>

defaultDataSourceFilters()

defaultDataSourceFilters() : array

Retrieve the default data source filters (when setting data on an entity).

Returns

array

resolveDataSourceFilter()

resolveDataSourceFilter(mixed  $toResolve) : callable|null

Retrieve the default data source filters (when setting data on an entity).

Note: Adapted from \Slim\CallableResolver.

Parameters

mixed $toResolve

A callable used when merging data.

Returns

callable|null

mergeDataSources()

mergeDataSources(array|\Charcoal\Admin\ArrayInterface  $dataset = null) : \Charcoal\Admin\AdminWidget

Retrieve the available data sources (when setting data on an entity).

Parameters

array|\Charcoal\Admin\ArrayInterface $dataset

The entity data.

Returns

\Charcoal\Admin\AdminWidget

Chainable

sidemenuGroupFactory()

sidemenuGroupFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the sidemenu group factory.

Throws

\RuntimeException

If the sidemenu group factory was not previously set.

Returns

\Charcoal\Factory\FactoryInterface

setSidemenuActions()

setSidemenuActions(array  $actions) : \Charcoal\Admin\Widget\FormSidemenuWidget

Set the sidemenu's actions.

Parameters

array $actions

One or more actions.

Returns

\Charcoal\Admin\Widget\FormSidemenuWidget —

Chainable.

createSidemenuActions()

createSidemenuActions(array  $actions) : array

Build the sidemenu's actions.

Sidemenu actions should come from the form settings defined by the "sidemenus". It is still possible to completly override those externally by setting the "actions" with the \self::setSidemenuActions() method.

Parameters

array $actions

Actions to resolve.

Returns

array —

Sidemenu actions.

defaultSidemenuActions()

defaultSidemenuActions() : array

Retrieve the sidemenu's default actions.

Returns

array