T3editorElement

class \TYPO3\CMS\T3editor\Form\Element\T3editorElement

Extends
AbstractFormElement

t3editor FormEngine widget

Table of Contents

Properties

$data  : array
Main data array to work on, given from parent to child elements
$defaultFieldControl  : array
A list of default field controls added to the element / container.
$defaultFieldInformation  : array
Default field information enabled for this element.
$defaultFieldWizard  : array
Default field wizards enabled for this element.
$defaultInputWidth  : int
Default width value for a couple of elements like text
$iconFactory  : IconFactory
$maxInputWidth  : int
Maximum width value for a couple of elements like text
$minimumInputWidth  : int
Minimum width value for a couple of elements like text
$mode  : string
$nodeFactory  : NodeFactory
Instance of the node factory to create sub elements, container and single element expansions.
$resultArray  : array

Methods

__construct()  : mixed
Container objects give $nodeFactory down to other containers.
render()  : array
Render t3editor element
appendValueToLabelInDebugMode()  : string
Append the value of a form field to its label
calculateColumnMarkup()  : array
Calculates the bootstrap grid classes based on the amount of columns defined in the checkbox item TCA
checkBoxParams()  : string
Creates checkbox parameters
formatValue()  : string
Format field content if 'format' is set to date, filesize, ..., user
formMaxWidth()  : int
Returns the max width in pixels for an elements like input and text
forwardOnFieldChangeQueryParams()  : array{fieldChangeFunc: array, fieldChangeFuncHash: string}
Forwards URL query params for `LinkBrowserController`
getBackendUser()  : BackendUserAuthentication
Returns the current BE user.
getHTMLCodeForEditor()  : string
Generates HTML with code editor
getLanguageService()  : LanguageService
getMode()  : Mode
getOnFieldChangeAttrs()  : array<string, string>
getOnFieldChangeItems()  : array<int, array>
getValidationDataAsJsonString()  : string
Build JSON string for validations rules.
hasNullCheckboxButNoPlaceholder()  : bool
Returns true if the "null value" checkbox should be rendered. This is used in some "text" based types like "text" and "input" for some renderType's.
hasNullCheckboxWithPlaceholder()  : bool
Returns true if the "null value" checkbox should be rendered and the placeholder handling is enabled. This is used in some "text" based types like "text" and "input" for some renderType's.
initializeResultArray()  : array
Initialize the array that is returned to parent after calling. This structure is identical for *all* nodes. Parent will merge the return of a child with its own stuff and in itself return an array of the same structure.
mergeChildReturnIntoExistingResult()  : array
Merge existing data with a child return array.
renderFieldControl()  : array
Merge field control configuration with default controls and render them.
renderFieldInformation()  : array
Merge field information configuration with default and render them.
renderFieldWizard()  : array
Merge field wizard configuration with default wizards and render them.
resolveJavaScriptEvaluation()  : array
Handle custom javascript `eval` implementations. $evalObject is a hook object for custom eval's. It is transferred to JS as a requireJsModule if possible.
validateOnFieldChange()  : bool

Properties

$data

Main data array to work on, given from parent to child elements

protected array $data = []

$defaultFieldControl

A list of default field controls added to the element / container.

protected array $defaultFieldControl = []

This property is often reset by single elements.

$defaultFieldInformation

Default field information enabled for this element.

protected array $defaultFieldInformation = ['tcaDescription' => ['renderType' => 'tcaDescription']]

$defaultFieldWizard

Default field wizards enabled for this element.

protected array $defaultFieldWizard = ['localizationStateSelector' => ['renderType' => 'localizati…
Show the full value['localizationStateSelector' => ['renderType' => 'localizationStateSelector'], 'otherLanguageContent' => ['renderType' => 'otherLanguageContent', 'after' => ['localizationStateSelector']], 'defaultLanguageDifferences' => ['renderType' => 'defaultLanguageDifferences', 'after' => ['otherLanguageContent']]]

$defaultInputWidth

Default width value for a couple of elements like text

protected int $defaultInputWidth = 30

$maxInputWidth

Maximum width value for a couple of elements like text

protected int $maxInputWidth = 50

$minimumInputWidth

Minimum width value for a couple of elements like text

protected int $minimumInputWidth = 10

$nodeFactory

Instance of the node factory to create sub elements, container and single element expansions.

protected NodeFactory $nodeFactory

Methods

__construct()

Container objects give $nodeFactory down to other containers.

public __construct(NodeFactory $nodeFactory, array $data) : mixed

Parameters

$nodeFactory : NodeFactory
$data : array

render()

Render t3editor element

public render() : array

Tags

throws
InvalidModeException
throws
InvalidArgumentException
throws
BadFunctionCallException

Return values

array —

As defined in initializeResultArray() of AbstractNode

appendValueToLabelInDebugMode()

Append the value of a form field to its label

protected appendValueToLabelInDebugMode(string|int $label, string|int $value) : string

Parameters

$label : string|int

The label which can also be an integer

$value : string|int

The value which can also be an integer

Return values

string

calculateColumnMarkup()

Calculates the bootstrap grid classes based on the amount of columns defined in the checkbox item TCA

protected calculateColumnMarkup(int $cols) : array

Parameters

$cols : int

Return values

array

checkBoxParams()

Creates checkbox parameters

protected checkBoxParams(string $itemName, int $formElementValue, int $checkbox, int $checkboxesCount[, array $fieldChangeFuncs = [] ][, bool $invert = false ]) : string

Parameters

$itemName : string

Form element name

$formElementValue : int

The value of the checkbox (representing checkboxes with the bits)

$checkbox : int

Checkbox # (0-9?)

$checkboxesCount : int

Total number of checkboxes in the array.

$fieldChangeFuncs : array = []

fieldChangeFunc items for client-side handling

$invert : bool = false

Inverts the state of the checkbox (but not of the bit value)

Return values

string —

either onclick attr or data-formengine-field-change-* attrs + possibly the checked-option set

formatValue()

Format field content if 'format' is set to date, filesize, ..., user

protected formatValue(string $format, string $itemValue[, array $formatOptions = [] ]) : string

Parameters

$format : string

Configuration for the display.

$itemValue : string

The value to display

$formatOptions : array = []

Format options

Return values

string —

Formatted field value

formMaxWidth()

Returns the max width in pixels for an elements like input and text

protected formMaxWidth([int $size = 48 ]) : int

Parameters

$size : int = 48

The abstract size value (1-48)

Return values

int —

Maximum width in pixels

forwardOnFieldChangeQueryParams()

Forwards URL query params for `LinkBrowserController`

protected forwardOnFieldChangeQueryParams(array<string, string|OnFieldChangeInterface> $items) : array{fieldChangeFunc: array, fieldChangeFuncHash: string}

Parameters

$items : array<string, string|OnFieldChangeInterface>

fieldChangeFunc items

Return values

array{fieldChangeFunc: array, fieldChangeFuncHash: string} —

relevant URL query params for LinkBrowserController

getHTMLCodeForEditor()

Generates HTML with code editor

protected getHTMLCodeForEditor(string $name[, string $class = '' ][, string $content = '' ][, array $attributes = [] ][, array $settings = [] ][, string $label = '' ][, array $hiddenfields = [] ]) : string

Parameters

$name : string

Name attribute of HTML tag

$class : string = ''

Class attribute of HTML tag

$content : string = ''

Content of the editor

$attributes : array = []

Any additional editor parameters

$settings : array = []
$label : string = ''

Codemirror panel label

$hiddenfields : array = []

Tags

throws
InvalidModeException

Return values

string —

Generated HTML code for editor

getOnFieldChangeAttrs()

protected getOnFieldChangeAttrs(string $event, array<string, string|OnFieldChangeInterface> $items) : array<string, string>

Parameters

$event : string

target client event, either change or click

$items : array<string, string|OnFieldChangeInterface>

fieldChangeFunc items

Return values

array<string, string> —

HTML attrs, not encoded - consumers MUST encode with htmlspecialchars

getValidationDataAsJsonString()

Build JSON string for validations rules.

protected getValidationDataAsJsonString(array $config) : string

Parameters

$config : array

Return values

string

hasNullCheckboxButNoPlaceholder()

Returns true if the "null value" checkbox should be rendered. This is used in some "text" based types like "text" and "input" for some renderType's.

protected hasNullCheckboxButNoPlaceholder() : bool

A field has eval=null set, but has no useOverridePlaceholder defined. Goal is to have a field that can distinct between NULL and empty string in the database. A checkbox and an additional hidden field will be created, both with the same name and prefixed with "control[active]". If the checkbox is set (value 1), the value from the casual input field will be written to the database. If the checkbox is not set, the hidden field transfers value=0 to DataHandler, the value of the input field will then be reset to NULL by the DataHandler at an early point in processing, so NULL will be written to DB as field value.

All that only works if the field is not within flex form scope since flex forms can not store a "null" value or distinct it from "empty string".

Return values

bool

hasNullCheckboxWithPlaceholder()

Returns true if the "null value" checkbox should be rendered and the placeholder handling is enabled. This is used in some "text" based types like "text" and "input" for some renderType's.

protected hasNullCheckboxWithPlaceholder() : bool

A field has useOverridePlaceholder set and null in eval and is not within a flex form. Here, a value from a deeper DB structure can be "fetched up" as value, and can also be overridden by a local value. This is used in FAL, where eg. the "title" field can have the default value from sys_file_metadata, the title field of sys_file_reference is then set to NULL. Or the "override" checkbox is set, and a string or an empty string is then written to the field of sys_file_reference. The situation is similar to hasNullCheckboxButNoPlaceholder(), but additionally a "default" value should be shown. To achieve this, again a hidden control[hidden] field is added together with a checkbox with the same name to transfer the information whether the default value should be used or not: Checkbox checked transfers 1 as value in control[active], meaning the overridden value should be used. Additionally to the casual input field, a second field is added containing the "placeholder" value. This field has no name attribute and is not transferred at all. Those two are then hidden / shown depending on the state of the above checkbox in via JS.

Return values

bool

initializeResultArray()

Initialize the array that is returned to parent after calling. This structure is identical for *all* nodes. Parent will merge the return of a child with its own stuff and in itself return an array of the same structure.

protected initializeResultArray() : array

Return values

array

mergeChildReturnIntoExistingResult()

Merge existing data with a child return array.

protected mergeChildReturnIntoExistingResult(array $existing, array $childReturn[, bool $mergeHtml = true ]) : array

The incoming $childReturn array should be initialized using initializeResultArray() beforehand.

Parameters

$existing : array

Currently merged array

$childReturn : array

Array returned by child

$mergeHtml : bool = true

If false, the ['html'] section of $childReturn will NOT be added to $existing

Return values

array —

Result array

renderFieldControl()

Merge field control configuration with default controls and render them.

protected renderFieldControl() : array

Return values

array —

Result array

renderFieldInformation()

Merge field information configuration with default and render them.

protected renderFieldInformation() : array

Return values

array —

Result array

renderFieldWizard()

Merge field wizard configuration with default wizards and render them.

protected renderFieldWizard() : array

Return values

array —

Result array

resolveJavaScriptEvaluation()

Handle custom javascript `eval` implementations. $evalObject is a hook object for custom eval's. It is transferred to JS as a requireJsModule if possible.

protected resolveJavaScriptEvaluation(array $resultArray, string $name, object|null $evalObject) : array

This is used by a couple of renderType's like various type="input", should be used with care and is internal for now.

Parameters

$resultArray : array
$name : string
$evalObject : object|null

Return values

array

validateOnFieldChange()

protected validateOnFieldChange(array<string, string|OnFieldChangeInterface> $items[, bool $deprecate = true ]) : bool

Parameters

$items : array<string, string|OnFieldChangeInterface>

fieldChangeFunc items

$deprecate : bool = true

whether to trigger deprecations

Return values

bool —

whether all items implement OnFieldChangeInterface

On this page