Constants

DATA_SOURCE_REQUEST

DATA_SOURCE_REQUEST

DATA_SOURCE_OBJECT

DATA_SOURCE_OBJECT

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

$sidebars

$sidebars : array

The form's sidebars.

Type

array

$formProperties

$formProperties : array

The form's controls.

Type

array

$hiddenProperties

$hiddenProperties : array

The form's hidden controls.

Type

array

$submitLabel

$submitLabel : \Charcoal\Admin\Widget\Translation|string

Label for the form submission button.

Type

\Charcoal\Admin\Widget\Translation|string

$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

$httpRequest

$httpRequest : \Psr\Http\Message\RequestInterface

Store the HTTP request object.

Type

\Psr\Http\Message\RequestInterface

$widgetFactory

$widgetFactory : \Charcoal\Factory\FactoryInterface

Store the factory instance for the current class.

Type

\Charcoal\Factory\FactoryInterface

Methods

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Parameters

\Pimple\Container $container

The DI container.

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

httpRequest()

httpRequest() : \Psr\Http\Message\RequestInterface

Retrieve the HTTP request object.

Throws

\RuntimeException

If an HTTP request was not previously set.

Returns

\Psr\Http\Message\RequestInterface

createFormProperty()

createFormProperty(array  $data = null) : \Charcoal\Admin\Widget\FormPropertyWidget

Parameters

array $data

Optional. The form property data to set.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

setSidebars()

setSidebars(array  $sidebars) : \Charcoal\Admin\Widget\FormWidget

Parameters

array $sidebars

The form sidebars.

Returns

\Charcoal\Admin\Widget\FormWidget

Chainable

addSidebar()

addSidebar(string  $sidebarIdent, array|\Charcoal\Admin\Ui\FormSidebarInterface  $sidebar) : \Charcoal\Admin\Widget\FormWidget

Parameters

string $sidebarIdent

The sidebar identifier.

array|\Charcoal\Admin\Ui\FormSidebarInterface $sidebar

The sidebar data or object.

Throws

\InvalidArgumentException

If the ident is not a string or the sidebar is not valid.

Returns

\Charcoal\Admin\Widget\FormWidget

Chainable

sidebars()

sidebars() : array<mixed,\Charcoal\Admin\Ui\FormSidebarInterface>|\Charcoal\Admin\Widget\Generator

Returns

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

setFormProperties()

setFormProperties(array  $properties) : \Charcoal\Ui\Form\FormInterface

Replace property controls to the form.

Parameters

array $properties

The form properties.

Returns

\Charcoal\Ui\Form\FormInterface —

Chainable

addFormProperties()

addFormProperties(array  $properties) : \Charcoal\Ui\Form\FormInterface

Add property controls to the form.

Parameters

array $properties

The form properties.

Returns

\Charcoal\Ui\Form\FormInterface —

Chainable

addFormProperty()

addFormProperty(string  $propertyIdent, array|\Charcoal\Admin\Widget\FormPropertyInterface  $formProperty) : \Charcoal\Ui\Form\FormInterface

Add a property control to the form.

If a given property uses a hidden form control, the form property will be added to \FormWidget::$hiddenProperties.

Parameters

string $propertyIdent

The property identifier.

array|\Charcoal\Admin\Widget\FormPropertyInterface $formProperty

The property object or structure.

Throws

\InvalidArgumentException

If the identifier or the property is invalid.

Returns

\Charcoal\Ui\Form\FormInterface —

Chainable

formProperties()

formProperties() : array<mixed,\Charcoal\Admin\Widget\FormPropertyWidget>|\Charcoal\Admin\Widget\Generator

Yield the form's property controls.

Returns

array<mixed,\Charcoal\Admin\Widget\FormPropertyWidget>|\Charcoal\Admin\Widget\Generator

setHiddenProperties()

setHiddenProperties(array  $properties) : \Charcoal\Ui\Form\FormInterface

Replace hidden property controls to the form.

Parameters

array $properties

The hidden form properties.

Returns

\Charcoal\Ui\Form\FormInterface —

Chainable

addHiddenProperties()

addHiddenProperties(array  $properties) : \Charcoal\Ui\Form\FormInterface

Add hidden property controls to the form.

Parameters

array $properties

The hidden form properties.

Returns

\Charcoal\Ui\Form\FormInterface —

Chainable

addHiddenProperty()

addHiddenProperty(string  $propertyIdent, array|\Charcoal\Admin\Widget\FormPropertyInterface  $formProperty) : \Charcoal\Ui\Form\FormInterface

Add a hidden property control to the form.

Parameters

string $propertyIdent

The property identifier.

array|\Charcoal\Admin\Widget\FormPropertyInterface $formProperty

The property object or structure.

Throws

\InvalidArgumentException

If the identifier or the property is invalid.

Returns

\Charcoal\Ui\Form\FormInterface —

Chainable

hiddenProperties()

hiddenProperties() : array<mixed,\Charcoal\Admin\Widget\FormPropertyWidget>|\Charcoal\Admin\Widget\Generator

Yield the form's hidden property controls.

Returns

array<mixed,\Charcoal\Admin\Widget\FormPropertyWidget>|\Charcoal\Admin\Widget\Generator

submitLabel()

submitLabel() : \Charcoal\Admin\Widget\Translation|string|null

Retrieve the label for the form submission button.

Returns

\Charcoal\Admin\Widget\Translation|string|null

defaultSubmitLabel()

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

Retrieve the default label for the form submission button.

Returns

\Charcoal\Translator\Translation|null

defaultGroupType()

defaultGroupType() : 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

setHttpRequest()

setHttpRequest(\Psr\Http\Message\RequestInterface  $request) : self

Set an HTTP request object.

Parameters

\Psr\Http\Message\RequestInterface $request

A PSR-7 compatible Request instance.

Returns

self

setWidgetFactory()

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

Set an widget factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory to create widgets.

Returns

self

widgetFactory()

widgetFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the widget factory.

Throws

\RuntimeException

If the widget factory was not previously set.

Returns

\Charcoal\Factory\FactoryInterface

dataFromRequest()

dataFromRequest() : array

Fetch metadata from the current request.

Returns

array

acceptedRequestData()

acceptedRequestData() : array

Retrieve the accepted metadata from the current request.

Returns

array