eZPublishCommunityProject  2013.9
eZ\Publish\Core\FieldType\RelationList\Type Class Reference

The RelationList field type. More...

+ Inheritance diagram for eZ\Publish\Core\FieldType\RelationList\Type:
+ Collaboration diagram for eZ\Publish\Core\FieldType\RelationList\Type:

Public Member Functions

 fromHash ($hash)
 Converts an $hash to the Value defined by the field type. More...
 
 getEmptyValue ()
 Returns the fallback default value of field type when no such default value is provided in the field definition in content types. More...
 
 getFieldTypeIdentifier ()
 Returns the field type identifier for this field type. More...
 
 getName (SPIValue $value)
 Returns the name of the given field value. More...
 
 isSearchable ()
 Returns whether the field type is searchable. More...
 
 toHash (SPIValue $value)
 Converts a $Value to a hash. More...
 
 validateFieldSettings ($fieldSettings)
 
- Public Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
 acceptValue ($inputValue)
 Potentially builds and checks the type and structure of the $inputValue. More...
 
 applyDefaultSettings (&$fieldSettings)
 Applies the default values to the fieldSettings of a FieldDefinitionCreateStruct. More...
 
 applyDefaultValidatorConfiguration (&$validatorConfiguration)
 Applies the default values to the given $validatorConfiguration of a FieldDefinitionCreateStruct. More...
 
 fieldSettingsFromHash ($fieldSettingsHash)
 Converts the given $fieldSettingsHash to field settings of the type. More...
 
 fieldSettingsToHash ($fieldSettings)
 Converts the given $fieldSettings to a simple hash format. More...
 
 fromPersistenceValue (PersistenceValue $fieldValue)
 Converts a persistence $fieldValue to a Value. More...
 
 getRelations (SPIValue $fieldValue)
 Returns relation data extracted from 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...
 
 isEmptyValue (SPIValue $value)
 Returns if the given $value is considered empty by the field type. More...
 
 isSearchable ()
 Returns whether the field type is searchable. 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...
 
 setTransformationProcessor (TransformationProcessor $transformationProcessor)
 
 toPersistenceValue (SPIValue $value)
 Converts a $value to a persistence value. More...
 
 validate (FieldDefinition $fieldDefinition, SPIValue $value)
 Validates a field based on the validators in the field definition. More...
 
 validateFieldSettings ($fieldSettings)
 Validates the fieldSettings of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
 
 validateValidatorConfiguration ($validatorConfiguration)
 Validates the validatorConfiguration of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
 
 validatorConfigurationFromHash ($validatorConfigurationHash)
 Converts the given $validatorConfigurationHash to a validator configuration of the type. More...
 
 validatorConfigurationToHash ($validatorConfiguration)
 Converts the given $validatorConfiguration to a simple hash format. More...
 
- Public Member Functions inherited from eZ\Publish\API\Repository\FieldType
 getName ($value)
 Returns a human readable string representation from the given $value. More...
 
 isEmptyValue ($value)
 Returns if the given $value is considered empty by the field type. More...
 
 toHash ($value)
 Converts the given $value into a plain hash format. More...
 

Public Attributes

const SELECTION_BROWSE = 0
 
const SELECTION_DROPDOWN = 1
 

Protected Member Functions

 checkValueStructure (BaseValue $value)
 Throws an exception if value structure is not of expected format. More...
 
 createValueFromInput ($inputValue)
 Inspects given $inputValue and potentially converts it into a dedicated value object. More...
 
 getSortInfo (BaseValue $value)
 Returns information for FieldValue->$sortKey relevant to the field type. More...
 
- Protected Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
 checkValueStructure (Value $value)
 Throws an exception if value structure is not of expected format. More...
 
 createValueFromInput ($inputValue)
 Inspects given $inputValue and potentially converts it into a dedicated value object. More...
 
 getSortInfo (Value $value)
 Returns information for FieldValue->$sortKey relevant to the field type. More...
 

Protected Attributes

 $settingsSchema
 
- Protected Attributes inherited from eZ\Publish\Core\FieldType\FieldType
 $settingsSchema = array()
 
 $transformationProcessor
 
 $validatorConfigurationSchema = array()
 

Additional Inherited Members

- Static Protected Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
static checkValueType ($value)
 Throws an exception if the given $value is not an instance of the supported value subtype. More...
 

Detailed Description

The RelationList field type.

This field type represents a relation to a content.

hash format ({

See Also
fromhash()}, {
toHash()}): array( 'destinationContentIds' => array( (int)$destinationContentId ) );

Member Function Documentation

eZ\Publish\Core\FieldType\RelationList\Type::checkValueStructure ( BaseValue  $value)
protected

Throws an exception if value structure is not of expected format.

Exceptions
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionIf the value does not match the expected structure.
Parameters
\eZ\Publish\Core\FieldType\RelationList\Value$value
Returns
void
eZ\Publish\Core\FieldType\RelationList\Type::createValueFromInput (   $inputValue)
protected

Inspects given $inputValue and potentially converts it into a dedicated value object.

Parameters
int | string | array | \eZ\Publish\API\Repository\Values\Content\ContentInfo | \eZ\Publish\Core\FieldType\RelationList\Value$inputValue
Returns
The potentially converted and structurally plausible value.
eZ\Publish\Core\FieldType\RelationList\Type::fromHash (   $hash)

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

Parameters
mixed$hash
Returns
$value

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\RelationList\Type::getEmptyValue ( )

Returns the fallback default value of field type when no such default value is provided in the field definition in content types.

Returns

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\RelationList\Type::getFieldTypeIdentifier ( )

Returns the field type identifier for this field type.

Returns
string

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\RelationList\Type::getName ( SPIValue  $value)

Returns the name of the given field value.

It will be used to generate content name and url alias if current field is designated to be used in the content name/urlAlias pattern.

Parameters
\eZ\Publish\Core\FieldType\RelationList\Value$value
Returns
string
eZ\Publish\Core\FieldType\RelationList\Type::getSortInfo ( BaseValue  $value)
protected

Returns information for FieldValue->$sortKey relevant to the field type.

For this FieldType, the related object's name is returned.

Parameters
\eZ\Publish\Core\FieldType\RelationList\Value$value
Returns
array
eZ\Publish\Core\FieldType\RelationList\Type::isSearchable ( )

Returns whether the field type is searchable.

Returns
boolean

Implements eZ\Publish\API\Repository\FieldType.

eZ\Publish\Core\FieldType\RelationList\Type::toHash ( SPIValue  $value)

Converts a $Value to a hash.

Parameters
\eZ\Publish\Core\FieldType\RelationList\Value$value
Returns
mixed
eZ\Publish\Core\FieldType\RelationList\Type::validateFieldSettings (   $fieldSettings)
See Also
::validateFieldSettings()
Parameters
mixed$fieldSettings
Returns
[]

Member Data Documentation

eZ\Publish\Core\FieldType\RelationList\Type::$settingsSchema
protected
Initial value:
= array(
'selectionMethod' => array(
'type' => 'int',
'default' => self::SELECTION_BROWSE,
),
'selectionDefaultLocation' => array(
'type' => 'string',
'default' => null,
),
'selectionContentTypes' => array(
'type' => 'array',
'default' => array(),
),
)
const eZ\Publish\Core\FieldType\RelationList\Type::SELECTION_BROWSE = 0
Todo:
Consider to add all 6 selection options
const eZ\Publish\Core\FieldType\RelationList\Type::SELECTION_DROPDOWN = 1

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