Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | List of all members
eZ\Publish\API\Repository\FieldType Interface Reference

Interface that FieldTypes expose to the public API. More...

Inheritance diagram for eZ\Publish\API\Repository\FieldType:

## Public Member Functions
| getFieldTypeIdentifier ()
| Returns the field type identifier for this field type. More...
| getName ($value)
| Returns a human readable string representation from the given $value. More...
| getSettingsSchema ()
| Returns a schema for the settings expected by the FieldType. More...
| getValidatorConfigurationSchema ()
| Returns a schema for the validator configuration expected by the FieldType. More...
| isSearchable ()
| Indicates if the field type supports indexing and sort keys for searching. More...
| isSingular ()
| Indicates if the field definition of this type can appear only once in the same ContentType. More...
| onlyEmptyInstance ()
| Indicates if the field definition of this type can be added to a ContentType with Content instances. More...
| getEmptyValue ()
| Returns the empty value for this field type. More...
| isEmptyValue ($value)
| Returns if the given $value is considered empty by the field type. More...
| fromHash ($hash)
| Converts an $hash to the Value defined by the field type. More...
| toHash ($value)
| Converts the given $value into a plain hash format. More...
| fieldSettingsToHash ($fieldSettings)
| Converts the given $fieldSettings to a simple hash format. More...
| fieldSettingsFromHash ($fieldSettingsHash)
| Converts the given $fieldSettingsHash to field settings of the type. More...
| validatorConfigurationToHash ($validatorConfiguration)
| Converts the given $validatorConfiguration to a simple hash format. More...
| validatorConfigurationFromHash ($validatorConfigurationHash)
| Converts the given $validatorConfigurationHash to a validator configuration of the type. More...
| validateValidatorConfiguration ($validatorConfiguration)
| Validates the validatorConfiguration of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
| validateFieldSettings ($fieldSettings)
| Validates the fieldSettings of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
| validateValue (FieldDefinition $fieldDef, Value $value)
| Validates a field value based on the validator configuration in the field definition. More...

## Detailed Description

Interface that FieldTypes expose to the public API.

See also
  eZ\Publish\SPI\FieldType\FieldType For implementer doc

Definition at line 17 of file API/Repository/FieldType.php.

## Member Function Documentation

## ◆ fieldSettingsFromHash()

eZ\Publish\API\Repository\FieldType::fieldSettingsFromHash | ( |  | $fieldSettingsHash | ) |

Converts the given $fieldSettingsHash to field settings of the type.

This is the reverse operation of fieldSettingsToHash().

Parameters

  array | hash | scalar | null | $fieldSettingsHash |

Returns
  mixed

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ fieldSettingsToHash()

eZ\Publish\API\Repository\FieldType::fieldSettingsToHash | ( |  | $fieldSettings | ) |

Converts the given $fieldSettings to a simple hash format.

Parameters

  mixed | $fieldSettings |

Returns
  array|hash|scalar|null

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ fromHash()

eZ\Publish\API\Repository\FieldType::fromHash | ( |  | $hash | ) |

Converts an $hash to the Value defined by the field type.

This is the reverse operation to toHash().

Parameters

  mixed | $hash |

Returns
  mixed

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ getEmptyValue()

eZ\Publish\API\Repository\FieldType::getEmptyValue | ( |  | ) |

Returns the empty value for this field type.

Returns
  mixed

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ getFieldTypeIdentifier()

eZ\Publish\API\Repository\FieldType::getFieldTypeIdentifier | ( |  | ) |

Returns the field type identifier for this field type.

Returns
  string

Implemented in eZ\Publish\Core\REST\Client\FieldType.

Referenced by eZ\Publish\Core\REST\Common\Output\FieldTypeSerializer\serializeValue().

## ◆ getName()

eZ\Publish\API\Repository\FieldType::getName | ( |  | $value | ) |

Returns a human readable string representation from the given $value.

Deprecated:
  Since 6.3/5.4.7, functionality moved to \eZ\Publish\SPI\FieldType\Nameable

Parameters

  mixed | $value |

Returns
  string

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ getSettingsSchema()

eZ\Publish\API\Repository\FieldType::getSettingsSchema | ( |  | ) |

Returns a schema for the settings expected by the FieldType.

Returns an arbitrary value, representing a schema for the settings of the FieldType.

Explanation: There are no possible generic schemas for defining settings input, which is why no schema for the return value of this method is defined. It is up to the implementer to define and document a schema for the return value and document it. In addition, it is necessary that all consumers of this interface (e.g. Public API, REST API, GUIs, ...) provide plugin mechanisms to hook adapters for the specific FieldType into. These adapters then need to be either shipped with the FieldType or need to be implemented by a third party. If there is no adapter available for a specific FieldType, it will not be usable with the consumer.

Returns
  mixed

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ getValidatorConfigurationSchema()

eZ\Publish\API\Repository\FieldType::getValidatorConfigurationSchema | ( |  | ) |

Returns a schema for the validator configuration expected by the FieldType.

Returns an arbitrary value, representing a schema for the validator configuration of the FieldType.

Explanation: There are no possible generic schemas for defining settings input, which is why no schema for the return value of this method is defined. It is up to the implementer to define and document a schema for the return value and document it. In addition, it is necessary that all consumers of this interface (e.g. Public API, REST API, GUIs, ...) provide plugin mechanisms to hook adapters for the specific FieldType into. These adapters then need to be either shipped with the FieldType or need to be implemented by a third party. If there is no adapter available for a specific FieldType, it will not be usable with the consumer.

Best practice:

It is considered best practice to return a hash map, which contains rudimentary settings structures, like e.g. for the "ezstring" FieldType

`array( 'stringLength' => array( 'minStringLength' => array( 'type' => 'int', 'default' => 0, ), 'maxStringLength' => array( 'type' => 'int' 'default' => null, ) ), );`

Returns
  mixed

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ isEmptyValue()

eZ\Publish\API\Repository\FieldType::isEmptyValue | ( |  | $value | ) |

Returns if the given $value is considered empty by the field type.

Usually, only the value returned by getEmptyValue() is considered empty but that is not always the case.

Note: This function assumes that $value is valid so this function can only be used reliably on $values that came from the API, not from the user.

Parameters

  mixed | $value |

Returns
  bool

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ isSearchable()

eZ\Publish\API\Repository\FieldType::isSearchable | ( |  | ) |

Indicates if the field type supports indexing and sort keys for searching.

Returns
  bool

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ isSingular()

eZ\Publish\API\Repository\FieldType::isSingular | ( |  | ) |

Indicates if the field definition of this type can appear only once in the same ContentType.

Returns
  bool

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ onlyEmptyInstance()

eZ\Publish\API\Repository\FieldType::onlyEmptyInstance | ( |  | ) |

Indicates if the field definition of this type can be added to a ContentType with Content instances.

Returns
  bool

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ toHash()

eZ\Publish\API\Repository\FieldType::toHash | ( |  | $value | ) |

Converts the given $value into a plain hash format.

Parameters

  mixed | $value |

Returns
  mixed

Implemented in eZ\Publish\Core\REST\Client\FieldType.

Referenced by eZ\Publish\Core\REST\Common\Output\FieldTypeSerializer\serializeValue().

## ◆ validateFieldSettings()

eZ\Publish\API\Repository\FieldType::validateFieldSettings | ( |  | $fieldSettings | ) |

Validates the fieldSettings of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct.

This methods determines if the given $fieldSettings are structurally correct and comply to the settings schema as defined in FieldType.

Parameters

  mixed | $fieldSettings |

Returns
  \eZ\Publish\SPI\FieldType\ValidationError[]

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ validateValidatorConfiguration()

eZ\Publish\API\Repository\FieldType::validateValidatorConfiguration | ( |  | $validatorConfiguration | ) |

Validates the validatorConfiguration of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct.

This methods determines if the given $validatorConfiguration is structurally correct and complies to the validator configuration schema as defined in FieldType.

Parameters

  mixed | $validatorConfiguration |

Returns
  \eZ\Publish\SPI\FieldType\ValidationError[]

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ validateValue()

eZ\Publish\API\Repository\FieldType::validateValue | ( | FieldDefinition | $fieldDef,
|  | Value | $value
| ) |  |

Validates a field value based on the validator configuration in the field definition.

Parameters

  \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition | $fieldDef | The field definition of the field
  \eZ\Publish\SPI\FieldType\Value | $value | The field value for which an action is performed

Returns
  \eZ\Publish\SPI\FieldType\ValidationError[]

## ◆ validatorConfigurationFromHash()

eZ\Publish\API\Repository\FieldType::validatorConfigurationFromHash | ( |  | $validatorConfigurationHash | ) |

Converts the given $validatorConfigurationHash to a validator configuration of the type.

Parameters

  array | hash | scalar | null | $validatorConfigurationHash |

Returns
  mixed

Implemented in eZ\Publish\Core\REST\Client\FieldType.

## ◆ validatorConfigurationToHash()

eZ\Publish\API\Repository\FieldType::validatorConfigurationToHash | ( |  | $validatorConfiguration | ) |

Converts the given $validatorConfiguration to a simple hash format.

Parameters

  mixed | $validatorConfiguration |

Returns
  array|hash|scalar|null

Implemented in eZ\Publish\Core\REST\Client\FieldType.

The documentation for this interface was generated from the following file:

- API/Repository/FieldType.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.