\Charcoal\Admin\WidgetFormPropertyWidget

Form Control Widget

For model properties.

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()
propertyFactory()
propertyInputFactory()
propertyDisplayFactory()
setOutputType()
outputType()
supportedOutputTypes()
setFormGroup()
formGroup()
clearFormGroup()
setData()
merge()
setPropertyType()
propertyType()
setPropertyIdent()
propertyIdent()
setPropertyData()
mergePropertyData()
propertyData()
setPropertyVal()
propertyVal()
setShowDescription()
showDescription()
setShowNotes()
showNotes()
showNotesAbove()
description()
notes()
hidden()
inputId()
inputName()
displayId()
displayName()
setInputType()
inputType()
setDisplayType()
displayType()
setProperty()
property()
prop()
showActiveLanguage()
setL10nMode()
l10nMode()
loopL10n()
l10n()
input()
display()
output()
$widgetId
DATA_SOURCE_REQUEST
DATA_SOURCE_OBJECT
HIDDEN_FORM_CONTROL
DEFAULT_FORM_CONTROL
PROPERTY_CONTROL
PROPERTY_DISPLAY
DEFAULT_OUTPUT
setModelFactory()
modelFactory()
addDataSources()
acceptedDataSources()
defaultDataSources()
defaultDataSourceFilters()
resolveDataSourceFilter()
mergeDataSources()
setPropertyFactory()
setPropertyInputFactory()
setPropertyDisplayFactory()
resolveOutputType()
resolvedOutputType()
$baseUrl
$adminConfig
$type
$showLabel
$outputType
$propertyType
$inputType
$displayType
$showDescription
$showNotes
$formGroup
N/A
setCoreData()
resolveInputType()
resolveDisplayType()
createProperty()
createInputProperty()
createDisplayProperty()
$template
$ident
$label
$lang
$showActions
$priority
$dataSources
$dataSourceFilters
$modelFactory
$property
$propertyIdent
$propertyVal
$propertyData
$inputProperty
$displayProperty
$l10nMode
$propertyFactory
$propertyInputFactory
$propertyDisplayFactory
$isMergingWidgetData
N/A

Constants

DATA_SOURCE_REQUEST

DATA_SOURCE_REQUEST

DATA_SOURCE_OBJECT

DATA_SOURCE_OBJECT

HIDDEN_FORM_CONTROL

HIDDEN_FORM_CONTROL

DEFAULT_FORM_CONTROL

DEFAULT_FORM_CONTROL

PROPERTY_CONTROL

PROPERTY_CONTROL

PROPERTY_DISPLAY

PROPERTY_DISPLAY

DEFAULT_OUTPUT

DEFAULT_OUTPUT

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

$type

$type : string|null

The widget's type.

Type

string|null

$showLabel

$showLabel : boolean

The label is displayed by default.

Type

boolean

$outputType

$outputType : string

The widget's property output type.

Type

string

$propertyType

$propertyType : string|null

The model's property type.

Type

string|null

$inputType

$inputType : string|null

The property control type.

Type

string|null

$displayType

$displayType : string|null

The property display type.

Type

string|null

$showDescription

$showDescription : boolean

The description is displayed by default.

Type

boolean

$showNotes

$showNotes : boolean

The notes are displayed by default.

Type

boolean

$formGroup

$formGroup : \Charcoal\Ui\FormGroup\FormGroupInterface

The form group the input belongs to.

Type

\Charcoal\Ui\FormGroup\FormGroupInterface

$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

$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

$property

$property : \Charcoal\Property\PropertyInterface|null

Store the model property.

Type

\Charcoal\Property\PropertyInterface|null

$propertyIdent

$propertyIdent : string|null

The model property's name.

Type

string|null

$propertyVal

$propertyVal : mixed

The model property's value.

Type

mixed

$propertyData

$propertyData : array

The model property's metadata.

Type

array

$inputProperty

$inputProperty : \Charcoal\Admin\Widget\PropertyInputInterface|null

Store the property control instance.

Type

\Charcoal\Admin\Widget\PropertyInputInterface|null

$displayProperty

$displayProperty : \Charcoal\Admin\Widget\PropertyDisplayInterface|null

Store the property display instance.

Type

\Charcoal\Admin\Widget\PropertyDisplayInterface|null

$l10nMode

$l10nMode : string

The L10N display mode.

Type

string

$propertyFactory

$propertyFactory : \Charcoal\Factory\FactoryInterface

Store the model property factory.

Type

\Charcoal\Factory\FactoryInterface

$propertyInputFactory

$propertyInputFactory : \Charcoal\Factory\FactoryInterface

Store the property form control factory.

Type

\Charcoal\Factory\FactoryInterface

$propertyDisplayFactory

$propertyDisplayFactory : \Charcoal\Factory\FactoryInterface

Store the property display factory.

Type

\Charcoal\Factory\FactoryInterface

$isMergingWidgetData

$isMergingWidgetData : boolean

Track the state of data merging.

Type

boolean

Methods

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Set the widget's dependencies.

Parameters

\Pimple\Container $container

Service 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

Retrieve the widget ID.

Returns

string

setType()

setType(string  $type) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the widget or property type.

Parameters

string $type

The widget or property type.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

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\Widget\FormPropertyWidget

Show/hide the property's label.

Parameters

boolean $show

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

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

showLabel()

showLabel() : boolean

Determine if the label is to be displayed.

Returns

boolean —

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

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

propertyFactory()

propertyFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the property factory.

Throws

\RuntimeException

If the property factory is missing.

Returns

\Charcoal\Factory\FactoryInterface

propertyInputFactory()

propertyInputFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the property control factory.

Throws

\RuntimeException

If the property control factory is missing.

Returns

\Charcoal\Factory\FactoryInterface

propertyDisplayFactory()

propertyDisplayFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the property display factory.

Throws

\RuntimeException

If the property display factory is missing.

Returns

\Charcoal\Factory\FactoryInterface

setOutputType()

setOutputType(string  $type) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the model's property type.

Can be either "input" or "display". A property input or property display identifier is also accepted.

Parameters

string $type

The input or display property type.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

outputType()

outputType() : string|null

Retrieve the widget's property output type.

Defaults to "input_type".

Throws

\LogicException

If the "input_type" and "display_type" are disabled.

Returns

string|null

supportedOutputTypes()

supportedOutputTypes() : array

Retrieve the supported property output types.

Returns

array

setFormGroup()

setFormGroup(\Charcoal\Ui\FormGroup\FormGroupInterface  $formGroup) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the form input's parent group.

Parameters

\Charcoal\Ui\FormGroup\FormGroupInterface $formGroup

The parent form group object.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

formGroup()

formGroup() : \Charcoal\Ui\FormGroup\FormGroupInterface

Retrieve the input's parent group.

Returns

\Charcoal\Ui\FormGroup\FormGroupInterface

setData()

setData(array|\Charcoal\Admin\Widget\ArrayAccess  $data) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the widget and property data.

Parameters

array|\Charcoal\Admin\Widget\ArrayAccess $data

Widget and property data.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

merge()

merge(array|\Traversable  $data) : \Charcoal\Admin\Widget\FormPropertyWidget

Merge widget and property data.

Parameters

array|\Traversable $data

Widget and property data.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

setPropertyType()

setPropertyType(string  $type) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the model's property type.

Parameters

string $type

The property type.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

propertyType()

propertyType() : string|null

Retrieve the model's property type.

Returns

string|null

setPropertyIdent()

setPropertyIdent(string  $propertyIdent) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the form's property identifier.

Parameters

string $propertyIdent

The property identifier.

Throws

\InvalidArgumentException

If the property ident is not a string.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

propertyIdent()

propertyIdent() : string|null

Retrieve the form's property identifier.

Returns

string|null

setPropertyData()

setPropertyData(array  $data) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the property metadata.

Parameters

array $data

The property configset.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

mergePropertyData()

mergePropertyData(array  $data) : \Charcoal\Admin\Widget\FormPropertyWidget

Merge the property metadata.

Parameters

array $data

The property configset.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

propertyData()

propertyData() : array

Retrieve the property metadata.

Returns

array

setPropertyVal()

setPropertyVal(mixed  $propertyVal) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the property's value.

Parameters

mixed $propertyVal

The property value.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

propertyVal()

propertyVal() : mixed

Retrieve the property's value.

Returns

mixed

setShowDescription()

setShowDescription(boolean  $show) : \Charcoal\Admin\Widget\FormPropertyWidget

Show/hide the property's description.

Parameters

boolean $show

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

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

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|string  $show) : \Charcoal\Admin\Widget\FormPropertyWidget

Show/hide the property's notes.

Parameters

boolean|string $show

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

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

showNotes()

showNotes() : boolean

Determine if the notes is to be displayed.

Returns

boolean —

If TRUE or unset, check if there are notes.

showNotesAbove()

showNotesAbove() : boolean

Returns

boolean

description()

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

Returns

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

notes()

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

Returns

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

hidden()

hidden() : boolean

Returns

boolean

inputId()

inputId() : string

Returns

string

inputName()

inputName() : string

Returns

string

displayId()

displayId() : string

Returns

string

displayName()

displayName() : string

Returns

string

setInputType()

setInputType(string  $type) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the property control type.

Parameters

string $type

The form control type.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

inputType()

inputType() : string

Retrieve the property control type.

Returns

string

setDisplayType()

setDisplayType(string  $type) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the property display type.

Parameters

string $type

The property display type.

Throws

\InvalidArgumentException

If the argument is not a string.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

displayType()

displayType() : string

Retrieve the property display type.

Returns

string

setProperty()

setProperty(\Charcoal\Property\PropertyInterface  $property) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the widget's model property.

Parameters

\Charcoal\Property\PropertyInterface $property

The property.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

property()

property() : \Charcoal\Property\PropertyInterface

Retrieve the widget's model property.

Returns

\Charcoal\Property\PropertyInterface

prop()

prop() : \Charcoal\Property\PropertyInterface

Alias of {@see self::property()}

Returns

\Charcoal\Property\PropertyInterface

showActiveLanguage()

showActiveLanguage() : boolean

Determine if the form control's active language should be displayed.

Returns

boolean

setL10nMode()

setL10nMode(string  $mode) : \Charcoal\Admin\Widget\FormPropertyWidget

Set the L10N display mode.

Parameters

string $mode

The L10N display mode.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

l10nMode()

l10nMode() : string

Retrieve the L10N display mode.

Returns

string

loopL10n()

loopL10n() : boolean

Determine if the property should output for each language.

Returns

boolean

l10n()

l10n() : boolean

Alias of {@see PropertyInterface::l10n()}.

Returns

boolean

input()

input() : \Charcoal\Admin\Widget\PropertyInputInterface

Retrieve the form control property.

Returns

\Charcoal\Admin\Widget\PropertyInputInterface

display()

display() : \Charcoal\Admin\Widget\PropertyDisplayInterface

Retrieve the display property.

Returns

\Charcoal\Admin\Widget\PropertyDisplayInterface

output()

output() : \Charcoal\Admin\Widget\PropertyInputInterface|\Charcoal\Admin\Widget\PropertyDisplayInterface

Yield the property output.

Either a display property or a form control property.

Returns

\Charcoal\Admin\Widget\PropertyInputInterface|\Charcoal\Admin\Widget\PropertyDisplayInterface

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

setPropertyFactory()

setPropertyFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Admin\Widget\FormPropertyWidget

Set a property factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory to create property values.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

setPropertyInputFactory()

setPropertyInputFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Admin\Widget\FormPropertyWidget

Set a property control factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory to create form controls for property values.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

setPropertyDisplayFactory()

setPropertyDisplayFactory(\Charcoal\Factory\FactoryInterface  $factory) : \Charcoal\Admin\Widget\FormPropertyWidget

Set a property display factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The factory to create displayable property values.

Returns

\Charcoal\Admin\Widget\FormPropertyWidget

Chainable

resolveOutputType()

resolveOutputType(string  $type) : string

Resolve the property output type.

Note: The "input_type" or "display_type" will be set if the output type is a valid output property.

Parameters

string $type

The input or display property type.

Throws

\InvalidArgumentException

If the property output type is invalid.

Returns

string —

Returns either "input" or "display".

resolvedOutputType()

resolvedOutputType() : string|null

Retrieved the resolved the property output type.

Returns

string|null —

Returns the property's "input_type" or "display_type".

setCoreData()

setCoreData(array  $data) : array

Set the core data for the widget and property's first.

Parameters

array $data

The widget and property data.

Returns

array —

The widget and property data.

resolveInputType()

resolveInputType() : string

Resolve the property control type.

Returns

string

resolveDisplayType()

resolveDisplayType() : string

Resolve the property display type.

Returns

string

createProperty()

createProperty() : \Charcoal\Property\PropertyInterface

Create the widget's model property from the property's dataset.

Returns

\Charcoal\Property\PropertyInterface

createInputProperty()

createInputProperty() : \Charcoal\Admin\Widget\PropertyInputInterface

Create the widget's form control property.

Returns

\Charcoal\Admin\Widget\PropertyInputInterface

createDisplayProperty()

createDisplayProperty() : \Charcoal\Admin\Widget\PropertyDisplayInterface

Create the widget's display property.

Returns

\Charcoal\Admin\Widget\PropertyDisplayInterface