Property | Type | Description | |
---|---|---|---|
$settingsSchema | mixed | The key is the setting name, and the value is the default value for given setting, set to null if no particular default should be set. | |
$transformationProcessor | String transformation processor, used to normalize sort string as needed. | ||
$validatorConfigurationSchema | mixed | This is a base implementation, containing an empty array() that indicates that no validators are supported. Overwrite in derived types, if validation is supported. |
Method | Description | |
---|---|---|
acceptValue ( mixed $inputValue ) : |
Potentially builds and checks the type and structure of the $inputValue. | |
applyDefaultSettings ( mixed &$fieldSettings ) | Applies the default values to the fieldSettings of a FieldDefinitionCreateStruct. | |
applyDefaultValidatorConfiguration ( mixed &$validatorConfiguration ) | Applies the default values to the given $validatorConfiguration of a FieldDefinitionCreateStruct. | |
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. | |
fromPersistenceValue ( eZ\Publish\SPI\Persistence\Content\FieldValue $fieldValue ) : |
Converts a persistence $fieldValue to a Value. | |
getRelations ( eZ\Publish\SPI\FieldType\Value $fieldValue ) : array | Returns relation data extracted from 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 ( eZ\Publish\SPI\FieldType\Value $value ) : boolean | Returns if the given $value is considered empty by the field type. | |
isSearchable ( ) : boolean | Returns whether the field type is searchable. | |
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. | |
setTransformationProcessor ( |
||
toPersistenceValue ( eZ\Publish\SPI\FieldType\Value $value ) : eZ\Publish\SPI\Persistence\Content\FieldValue | Converts a $value to a persistence value. | |
validate ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition, eZ\Publish\SPI\FieldType\Value $value ) : eZ\Publish\SPI\FieldType\ValidationError[] | Validates a field based on the validators in the field definition. | |
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. | |
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 | Description | |
---|---|---|
checkValueStructure ( |
Throws an exception if value structure is not of expected format. | |
checkValueType ( mixed $value ) | Throws an exception if the given $value is not an instance of the supported value subtype. | |
createValueFromInput ( mixed $inputValue ) : mixed | Inspects given $inputValue and potentially converts it into a dedicated value object. | |
getSortInfo ( |
Returns information for FieldValue->$sortKey relevant to the field type. |
final public acceptValue ( mixed $inputValue ) : |
||
$inputValue | mixed | |
return | The potentially converted and structurally plausible value. |
public applyDefaultSettings ( mixed &$fieldSettings ) | ||
$fieldSettings | mixed |
public applyDefaultValidatorConfiguration ( mixed &$validatorConfiguration ) | ||
$validatorConfiguration | mixed |
protected function checkValueStructure( Value $value )
{
if ( !is_array( $value->cookies ) )
{
throw new InvalidArgumentException( "An array of assorted cookies was expected." );
}
}
abstract protected checkValueStructure ( |
||
$value |
static protected function checkValueType( $value )
{
if ( !$inputValue instanceof \eZ\Publish\Core\FieldType\CookieJar\Value ) )
{
throw new InvalidArgumentException( "Given value type is not supported." );
}
}
protected static checkValueType ( mixed $value ) | ||
$value | mixed | A value returned by {@see \createValueFromInput()}. |
protected function createValueFromInput( $inputValue )
{
if ( is_array( $inputValue ) )
{
$inputValue = \eZ\Publish\Core\FieldType\CookieJar\Value( $inputValue );
}
return $inputValue;
}
abstract protected createValueFromInput ( mixed $inputValue ) : mixed | ||
$inputValue | mixed | |
return | mixed | The potentially converted input value. |
public fromPersistenceValue ( eZ\Publish\SPI\Persistence\Content\FieldValue $fieldValue ) : |
||
$fieldValue | eZ\Publish\SPI\Persistence\Content\FieldValue | |
return |
public getRelations ( eZ\Publish\SPI\FieldType\Value $fieldValue ) : array | ||
$fieldValue | eZ\Publish\SPI\FieldType\Value | |
return | array | Hash with relation type as key and array of destination content ids as value.
Example:
array(
\eZ\Publish\API\Repository\Values\Content\Relation::LINK => array(
"contentIds" => array( 12, 13, 14 ),
"locationIds" => array( 24 )
),
\eZ\Publish\API\Repository\Values\Content\Relation::EMBED => array(
"contentIds" => array( 12 ),
"locationIds" => array( 24, 45 )
),
\eZ\Publish\API\Repository\Values\Content\Relation::FIELD => array( 12 )
)
|
public getSettingsSchema ( ) : mixed | ||
return | mixed |
protected getSortInfo ( |
||
$value | ||
return | mixed |
public getValidatorConfigurationSchema ( ) : mixed | ||
return | mixed |
public isEmptyValue ( eZ\Publish\SPI\FieldType\Value $value ) : boolean | ||
$value | eZ\Publish\SPI\FieldType\Value | |
return | boolean |
public isSearchable ( ) : boolean | ||
return | boolean |
public isSingular ( ) : boolean | ||
return | boolean |
public onlyEmptyInstance ( ) : boolean | ||
return | boolean |
public setTransformationProcessor ( |
||
$transformationProcessor |
public toPersistenceValue ( eZ\Publish\SPI\FieldType\Value $value ) : eZ\Publish\SPI\Persistence\Content\FieldValue | ||
$value | eZ\Publish\SPI\FieldType\Value | |
return | eZ\Publish\SPI\Persistence\Content\FieldValue |
public validate ( eZ\Publish\API\Repository\Values\ContentType\FieldDefinition $fieldDefinition, eZ\Publish\SPI\FieldType\Value $value ) : eZ\Publish\SPI\FieldType\ValidationError[] | ||
$fieldDefinition | 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[] |
public validateFieldSettings ( mixed $fieldSettings ) : eZ\Publish\SPI\FieldType\ValidationError[] | ||
$fieldSettings | mixed | |
return | eZ\Publish\SPI\FieldType\ValidationError[] |
public validateValidatorConfiguration ( mixed $validatorConfiguration ) : eZ\Publish\SPI\FieldType\ValidationError[] | ||
$validatorConfiguration | mixed | |
return | eZ\Publish\SPI\FieldType\ValidationError[] |
protected mixed $settingsSchema | ||
return | mixed |
protected TransformationProcessor,eZ\Publish\Core\Persistence $transformationProcessor | ||
return |
protected mixed $validatorConfigurationSchema | ||
return | mixed |