FieldTypeFactory

class \TYPO3\CMS\Core\Schema\FieldTypeFactory

Create field objects based on the TCA of the "columns" area.

A field type is a class that represents a field in a schema.

Currently, the FieldTypes are hard-coded in this class, but in the future, this might be moved into a more flexible registry.

Also, the class currently encapsulates the building of the FlexFormSchema (which in turn also has fields), however, since this has some tight coupling this resides here for the time being, but should be extracted later-on.

Some interesting points:

  • the special type "select" is separated into two different classes - one with relations, and one without.

Table of Contents

Properties

$availableFieldTypes  : array<string, class-string>

Methods

createFieldType()  : FieldTypeInterface
createFlexFormField()  : FlexFormFieldType
First, parse the data structures (and if we only have a subschema, we use that one, ofc)
createFromTca()  : FieldTypeInterface
Basic factory to create the field type from the TCA configuration via new().
hasFieldType()  : bool
streamlineFieldConfiguration()  : array
Removes the "config" subkey from TCA, to make it easier to work with the configuration array, also makes caching smaller.

Properties

$availableFieldTypes

protected array<string, class-string> $availableFieldTypes = ['category' => \TYPO3\CMS\Core\Schema\Field\CategoryFieldTyp…
Show the full value['category' => \TYPO3\CMS\Core\Schema\Field\CategoryFieldType::class, 'check' => \TYPO3\CMS\Core\Schema\Field\CheckboxFieldType::class, 'color' => \TYPO3\CMS\Core\Schema\Field\ColorFieldType::class, 'country' => \TYPO3\CMS\Core\Schema\Field\CountryFieldType::class, 'datetime' => \TYPO3\CMS\Core\Schema\Field\DateTimeFieldType::class, 'email' => \TYPO3\CMS\Core\Schema\Field\EmailFieldType::class, 'file' => \TYPO3\CMS\Core\Schema\Field\FileFieldType::class, 'flex' => \TYPO3\CMS\Core\Schema\Field\FlexFormFieldType::class, 'folder' => \TYPO3\CMS\Core\Schema\Field\FolderFieldType::class, 'group' => \TYPO3\CMS\Core\Schema\Field\GroupFieldType::class, 'imageManipulation' => \TYPO3\CMS\Core\Schema\Field\ImageManipulationFieldType::class, 'inline' => \TYPO3\CMS\Core\Schema\Field\InlineFieldType::class, 'input' => \TYPO3\CMS\Core\Schema\Field\InputFieldType::class, 'json' => \TYPO3\CMS\Core\Schema\Field\JsonFieldType::class, 'language' => \TYPO3\CMS\Core\Schema\Field\LanguageFieldType::class, 'link' => \TYPO3\CMS\Core\Schema\Field\LinkFieldType::class, 'none' => \TYPO3\CMS\Core\Schema\Field\NoneFieldType::class, 'number' => \TYPO3\CMS\Core\Schema\Field\NumberFieldType::class, 'passthrough' => \TYPO3\CMS\Core\Schema\Field\PassthroughFieldType::class, 'password' => \TYPO3\CMS\Core\Schema\Field\PasswordFieldType::class, 'radio' => \TYPO3\CMS\Core\Schema\Field\RadioFieldType::class, 'slug' => \TYPO3\CMS\Core\Schema\Field\SlugFieldType::class, 'text' => \TYPO3\CMS\Core\Schema\Field\TextFieldType::class, 'user' => \TYPO3\CMS\Core\Schema\Field\UserFieldType::class, 'uuid' => \TYPO3\CMS\Core\Schema\Field\UuidFieldType::class]

Methods

createFieldType()

public createFieldType(string $fieldName, array $configuration, string $schemaName, RelationMap $relationMap[, string|null $parentSchemaName = null ][, string|null $parentFieldName = null ]) : FieldTypeInterface

Parameters

$fieldName : string
$configuration : array
$schemaName : string
$relationMap : RelationMap
$parentSchemaName : string|null = null
$parentFieldName : string|null = null

Return values

FieldTypeInterface

createFlexFormField()

First, parse the data structures (and if we only have a subschema, we use that one, ofc)

protected createFlexFormField(string $mainSchemaName, string $fieldName, array $tcaConfig, RelationMap $relationMap[, string|null $subSchemaName = null ]) : FlexFormFieldType

Parameters

$mainSchemaName : string
$fieldName : string
$tcaConfig : array
$relationMap : RelationMap
$subSchemaName : string|null = null

Return values

FlexFormFieldType

createFromTca()

Basic factory to create the field type from the TCA configuration via new().

protected createFromTca(string $targetClass, string $fieldName, array $fieldConfiguration[, array|null $relations = null ]) : FieldTypeInterface

Parameters

$targetClass : string
$fieldName : string
$fieldConfiguration : array
$relations : array|null = null

Return values

FieldTypeInterface

hasFieldType()

protected hasFieldType(string $fieldType) : bool

Parameters

$fieldType : string

Return values

bool

streamlineFieldConfiguration()

Removes the "config" subkey from TCA, to make it easier to work with the configuration array, also makes caching smaller.

protected streamlineFieldConfiguration(array $fieldConfiguration) : array

Parameters

$fieldConfiguration : array

Return values

array
On this page