PHP Class eZ\Publish\Core\REST\Client\FieldType

Inheritance: implements eZ\Publish\API\Repository\FieldType
Show file Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$innerFieldType eZ\Publish\API\Repository\FieldType Wrapped FieldType.

Public Methods

Method Description
__construct ( eZ\Publish\SPI\FieldType\FieldType $innerFieldType )
fieldSettingsFromHash ( array | hash | scalar | null $fieldSettingsHash ) : mixed Converts the given $fieldSettingsHash to field settings of the type.
fieldSettingsToHash ( mixed $fieldSettings ) : array | hash | scalar | null Converts the given $fieldSettings to a simple hash format.
fromHash ( mixed $hash ) : mixed Converts an $hash to the Value defined by the field type.
getEmptyValue ( ) : mixed Returns the fallback default value of field type when no such default value is provided in the field definition in content types.
getFieldTypeIdentifier ( ) : string Returns the field type identifier for this field type.
getName ( $value )
getSettingsSchema ( ) : mixed Returns a schema for the settings expected by the FieldType.
getValidatorConfigurationSchema ( ) : mixed Returns a schema for the validator configuration expected by the FieldType.
isEmptyValue ( mixed $value ) : boolean Returns if the given $value is considered empty by the field type.
isSearchable ( ) : boolean Indicates if the field type supports indexing and sort keys for searching.
isSingular ( ) : boolean Indicates if the field definition of this type can appear only once in the same ContentType.
onlyEmptyInstance ( ) : boolean Indicates if the field definition of this type can be added to a ContentType with Content instances.
toHash ( mixed $value ) : mixed Converts a Value to a hash.
validateFieldSettings ( mixed $fieldSettings ) : eZ\Publish\SPI\FieldType\ValidationError[] Validates the fieldSettings of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct.
validateValidatorConfiguration ( mixed $validatorConfiguration ) : eZ\Publish\SPI\FieldType\ValidationError[] Validates the validatorConfiguration of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct.
validateValue ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDef, eZ\Publish\SPI\FieldType\Value $value ) : eZ\Publish\SPI\FieldType\ValidationError[] Validates a field value based on the validator configuration in the field definition.
validatorConfigurationFromHash ( array | hash | scalar | null $validatorConfigurationHash ) : mixed Converts the given $validatorConfigurationHash to a validator configuration of the type.
validatorConfigurationToHash ( mixed $validatorConfiguration ) : array | hash | scalar | null Converts the given $validatorConfiguration to a simple hash format.

Method Details

__construct() public method

public __construct ( eZ\Publish\SPI\FieldType\FieldType $innerFieldType )
$innerFieldType eZ\Publish\SPI\FieldType\FieldType

fieldSettingsFromHash() public method

This is the reverse operation of {@link fieldSettingsToHash()}.
public fieldSettingsFromHash ( array | hash | scalar | null $fieldSettingsHash ) : mixed
$fieldSettingsHash array | hash | scalar | null
return mixed

fieldSettingsToHash() public method

Converts the given $fieldSettings to a simple hash format.
public fieldSettingsToHash ( mixed $fieldSettings ) : array | hash | scalar | null
$fieldSettings mixed
return array | hash | scalar | null

fromHash() public method

Converts an $hash to the Value defined by the field type.
public fromHash ( mixed $hash ) : mixed
$hash mixed
return mixed

getEmptyValue() public method

Returns the fallback default value of field type when no such default value is provided in the field definition in content types.
public getEmptyValue ( ) : mixed
return mixed

getFieldTypeIdentifier() public method

Returns the field type identifier for this field type.
public getFieldTypeIdentifier ( ) : string
return string

getName() public method

public getName ( $value )

getSettingsSchema() public method

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 implementor 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.
public getSettingsSchema ( ) : mixed
return mixed

getValidatorConfigurationSchema() public method

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 implementor 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, ) ), );

isEmptyValue() public method

Usually, only the value returned by {@link 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.
public isEmptyValue ( mixed $value ) : boolean
$value mixed
return boolean

isSearchable() public method

Indicates if the field type supports indexing and sort keys for searching.
public isSearchable ( ) : boolean
return boolean

isSingular() public method

Indicates if the field definition of this type can appear only once in the same ContentType.
public isSingular ( ) : boolean
return boolean

onlyEmptyInstance() public method

Indicates if the field definition of this type can be added to a ContentType with Content instances.
public onlyEmptyInstance ( ) : boolean
return boolean

toHash() public method

Converts a Value to a hash.
public toHash ( mixed $value ) : mixed
$value mixed
return mixed

validateFieldSettings() public method

This methods determines if the given $fieldSettings are structurally correct and comply to the settings schema as defined in FieldType.
public validateFieldSettings ( mixed $fieldSettings ) : eZ\Publish\SPI\FieldType\ValidationError[]
$fieldSettings mixed
return eZ\Publish\SPI\FieldType\ValidationError[]

validateValidatorConfiguration() public method

This methods determines if the given $validatorConfiguration is structurally correct and complies to the validator configuration schema as defined in FieldType.
public validateValidatorConfiguration ( mixed $validatorConfiguration ) : eZ\Publish\SPI\FieldType\ValidationError[]
$validatorConfiguration mixed
return eZ\Publish\SPI\FieldType\ValidationError[]

validateValue() public method

Validates a field value based on the validator configuration in the field definition.
public validateValue ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDef, eZ\Publish\SPI\FieldType\Value $value ) : eZ\Publish\SPI\FieldType\ValidationError[]
$fieldDef eZ\Publish\API\Repository\Values\ContentType\FieldDefinition The field definition of the field
$value eZ\Publish\SPI\FieldType\Value The field value for which an action is performed
return eZ\Publish\SPI\FieldType\ValidationError[]

validatorConfigurationFromHash() public method

Converts the given $validatorConfigurationHash to a validator configuration of the type.
public validatorConfigurationFromHash ( array | hash | scalar | null $validatorConfigurationHash ) : mixed
$validatorConfigurationHash array | hash | scalar | null
return mixed

validatorConfigurationToHash() public method

Converts the given $validatorConfiguration to a simple hash format.
public validatorConfigurationToHash ( mixed $validatorConfiguration ) : array | hash | scalar | null
$validatorConfiguration mixed
return array | hash | scalar | null

Property Details

$innerFieldType protected property

Wrapped FieldType.
protected FieldType,eZ\Publish\API\Repository $innerFieldType
return eZ\Publish\API\Repository\FieldType