\Charcoal\Admin\Widget\FormGroupStructureFormGroup

Form Group Structure Property

The form group widget displays a set of form controls based on properties assigned to the widget directly or a proxy structure property.

Examples

Example #1 — Structure widget

"properties": {
    "extra_data": {
        "type": "structure",
        "structure_metadata": {
            "properties": { … },
            "admin": {
                "form_groups": { … },
                "default_form_group": "…"
            }
        }
    }
},
"widgets": [
    {
        "title": "Extra Data",
        "type": "charcoal/admin/widget/form-group/structure",
        "template": "charcoal/admin/widget/form-group/structure",
        "storage_property": "extra_data"
    }
]

Example #2 — With verbose storage declaration

{@todo Eventually, the form group could support other storage sources such as file-based or a database such as an SQL server.}

{
    "title": "Extra Data",
    "type": "charcoal/admin/widget/form-group/structure",
    "template": "charcoal/admin/widget/form-group/structure",
    "storage": {
        "type": "property",
        "property": "extra_data"
    }
}

Summary

Methods
Properties
Constants
setDisplay()
display()
displays()
setShowEmpty()
showEmpty()
__construct()
setDependencies()
setData()
type()
setWidgetId()
widgetId()
setGroupProperties()
groupProperties()
setPropertiesOptions()
propertiesOptions()
hasFormProperties()
formProperties()
languages()
description()
notes()
setShowNotes()
showNotesAbove()
showHeader()
showFooter()
obj()
setFormGroup()
formGroup()
clearFormGroup()
setStorageProperty()
storageProperty()
structProperties()
No public properties found
No constants found
supportedDisplayLayouts()
defaultDisplay()
parsedFormProperties()
finalizeStructure()
$display
$showEmpty
$parsedFormProperties
$obj
$storage
$storageProperty
$isStructureFinalized
$rawData
N/A
No private methods found
$widgetId
$showNotesAbove
$groupProperties
$propertiesOptions
$formGroup
N/A

Properties

$display

$display : string|null

How to display the structure properties.

Type

string|null

$showEmpty

$showEmpty : boolean

How to display an empty structure.

Type

boolean

$parsedFormProperties

$parsedFormProperties : array|null

Type

array|null

$obj

$obj : \Charcoal\Admin\Widget\FormGroup\ModelInterface|null

The form group's storage model.

Type

\Charcoal\Admin\Widget\FormGroup\ModelInterface|null

$storage

$storage : array|\Charcoal\Property\PropertyInterface|\Charcoal\Admin\Widget\FormGroup\SourceInterface|null

The form group's storage medium.

Type

array|\Charcoal\Property\PropertyInterface|\Charcoal\Admin\Widget\FormGroup\SourceInterface|null

$storageProperty

$storageProperty : \Charcoal\Property\PropertyInterface|null

The form group's storage target. {@deprecated In favor of $storage.}

Type

\Charcoal\Property\PropertyInterface|null

$isStructureFinalized

$isStructureFinalized : boolean

Whether the form is ready.

Type

boolean

$rawData

$rawData : array|null

The form group's raw data.

Type

array|null

$widgetId

$widgetId : string

The widget identifier.

Type

string

$showNotesAbove

$showNotesAbove : boolean

Whether notes shoudl be display before or after the form fields.

Type

boolean

$groupProperties

$groupProperties : array

Type

array

$propertiesOptions

$propertiesOptions : array

Type

array

$formGroup

$formGroup : \Charcoal\Ui\FormGroup\FormGroupInterface|null

The form group the input belongs to.

Type

\Charcoal\Ui\FormGroup\FormGroupInterface|null

Methods

setDisplay()

setDisplay(string  $display) : self

Set the property's display layout.

Parameters

string $display

The layout for the tickable elements.

Throws

\InvalidArgumentException

If the given layout is invalid.

\OutOfBoundsException

If the given layout is unsupported.

Returns

self

display()

display() : string|null

Retrieve the property's display layout.

Returns

string|null

displays()

displays() : array

Retrieve the display layouts; for templating.

Returns

array

setShowEmpty()

setShowEmpty(boolean  $show) : self

Show/hide the notice when the structure is empty.

Parameters

boolean $show

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

Returns

self

showEmpty()

showEmpty() : boolean

Determine if a notice should be displayed when the structure is empty.

Returns

boolean

__construct()

__construct(array|\ArrayAccess  $data) 

Parameters

array|\ArrayAccess $data

Dependencies.

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Parameters

\Pimple\Container $container

The DI container.

type()

type() : string

Returns

string

setWidgetId()

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

Parameters

string $widgetId

The widget identifier.

Returns

\Charcoal\Admin\Widget\AdminWidget —

Chainable

widgetId()

widgetId() : string

Returns

string

setGroupProperties()

setGroupProperties(array  $properties) : \Charcoal\Admin\Widget\FormGroupWidget

Parameters

array $properties

The group properties.

Returns

\Charcoal\Admin\Widget\FormGroupWidget

Chainable

groupProperties()

groupProperties() : array

Returns

array

setPropertiesOptions()

setPropertiesOptions(array  $properties) : \Charcoal\Admin\Widget\FormGroupWidget

Parameters

array $properties

The options to customize the group properties.

Returns

\Charcoal\Admin\Widget\FormGroupWidget

Chainable

propertiesOptions()

propertiesOptions() : array

Returns

array

hasFormProperties()

hasFormProperties() : boolean

Determine if the form group has properties.

Returns

boolean

formProperties()

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

Retrieve the object's properties from the form.

Throws

\UnexpectedValueException

If a property data is invalid.

Returns

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

languages()

languages() : array

Retrieve the available languages, formatted for the sidebar language-switcher.

Returns

array

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

setShowNotes()

setShowNotes(boolean|string  $show) : \Charcoal\Admin\Widget\FormGroupWidget

Show/hide the widget's notes.

Parameters

boolean|string $show

Whether to show or hide notes.

Returns

\Charcoal\Admin\Widget\FormGroupWidget

Chainable

showNotesAbove()

showNotesAbove() : boolean

Returns

boolean

showHeader()

showHeader() : boolean

Determine if the header is to be displayed.

Returns

boolean —

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

showFooter()

showFooter() : boolean

Determine if the footer is to be displayed.

Returns

boolean —

If TRUE or unset, check if there are notes.

obj()

obj() : \Charcoal\Model\ModelInterface

Retrieve the form's object.

Throws

\RuntimeException

If the form doesn't have a model.

Returns

\Charcoal\Model\ModelInterface

setFormGroup()

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

Set the form input's parent group.

Parameters

\Charcoal\Ui\FormGroup\FormGroupInterface $formGroup

The parent form group object.

Returns

\Charcoal\Admin\Widget\FormGroup\StructureFormGroup

formGroup()

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

Retrieve the input's parent group.

Returns

\Charcoal\Ui\FormGroup\FormGroupInterface|null

setStorageProperty()

setStorageProperty(string|\Charcoal\Property\PropertyInterface  $propertyIdent) : \Charcoal\Admin\Widget\FormGroup\StructureFormGroup

Set the form group's storage target.

Must be a property of the form's object model that will receive an associative array of the form group's data.

Parameters

string|\Charcoal\Property\PropertyInterface $propertyIdent

The property identifier—or instance—of a storage property.

Throws

\InvalidArgumentException

If the property identifier is not a string.

\UnexpectedValueException

If a property data is invalid.

Returns

\Charcoal\Admin\Widget\FormGroup\StructureFormGroup

storageProperty()

storageProperty() : \Charcoal\Property\PropertyInterface

Retrieve the form group's storage property master.

Throws

\RuntimeException

If the storage property was not previously set.

Returns

\Charcoal\Property\PropertyInterface

structProperties()

structProperties() : array

Retrieve the properties from the storage property's structure.

Returns

array

supportedDisplayLayouts()

supportedDisplayLayouts() : array

Retrieve the supported display layouts.

Returns

array

defaultDisplay()

defaultDisplay() : array

Retrieve the default display layout.

Returns

array

parsedFormProperties()

parsedFormProperties() : array

Parse the form group and model properties.

Returns

array

finalizeStructure()

finalizeStructure(boolean  $reload = false) : void

Finalize the form group's properies, entries, and layout.

Parameters

boolean $reload

Rebuild the form group's structure.