eZPublishCommunityProject(LegacyStack)  2013.9
eZDataType Class Reference

Base class for content datatypes. More...

+ Inheritance diagram for eZDataType:

Public Member Functions

 attribute ($attr)
 
 attributes ()
 
 batchInitializeObjectAttributeData ($classAttribute)
 
 classAttributeContent ($classAttribute)
 
 classAttributeRemovableInformation ($classAttribute, $includeAll=true)
 
 classDisplayInformation ($classAttribute, $mergeInfo=false)
 
 cloneClassAttribute ($oldClassAttribute, $newClassAttribute)
 
 contentActionList ($classAttribute)
 Return content action(s) which can be performed on object containing the current datatype. More...
 
 createContentObjectAttributeDOMNode ($objectAttribute)
 Create empty content object attribute DOM node. More...
 
 customClassAttributeHTTPAction ($http, $action, $classAttribute)
 
 customObjectAttributeHTTPAction ($http, $action, $objectAttribute, $parameters)
 
 customSorting ()
 
 customSortingSQL ($params)
 
 deleteStoredClassAttribute ($classAttribute, $version=null)
 
 deleteStoredObjectAttribute ($objectAttribute, $version=null)
 
 diff ($old, $new, $options=false)
 
 editTemplate ($contentobjectAttribute)
 
 eZDataType ($dataTypeString, $name, $properties=array())
 
 fetchActionValue ($action, $actionName, &$value)
 
 fetchClassAttributeHTTPInput ($http, $base, $classAttribute)
 
 fetchCollectionAttributeHTTPInput ($collection, $collectionAttribute, $http, $base, $objectAttribute)
 
 fetchObjectAttributeHTTPInput ($http, $base, $objectAttribute)
 
 fixRelatedObjectItem ($contentObjectAttribute, $objectID, $mode)
 
 fixupClassAttributeHTTPInput ($http, $base, $classAttribute)
 
 fixupCollectionAttributeHTTPInput ($http, $base, $objectAttribute)
 
 fixupObjectAttributeHTTPInput ($http, $base, $objectAttribute)
 
 fromString ($objectAttribute, $string)
 
 getDBAExtensionFilePath ()
 
 getDBAFileName ()
 
 getDBAFilePath ($checkExtensions=true)
 
 handleCustomObjectHTTPActions ($http, $attributeDataBaseName, $customActionAttributeArray, $customActionParameters)
 
 handleDownload ($object, $objectVersion, $objectLanguage, $objectAttribute)
 
 hasAttribute ($attr)
 
 hasInformationCollection ()
 
 hasObjectAttributeContent ($contentObjectAttribute)
 
 hasStoredFileInformation ($object, $objectVersion, $objectLanguage, $objectAttribute)
 
 importDBDataFromDBAFile ($dbaFilePath=false)
 
 informationTemplate ($contentobjectAttribute)
 
 initializeClassAttribute ($classAttribute)
 
 initializeObjectAttribute ($objectAttribute, $currentVersion, $originalContentObjectAttribute)
 
 insertHTTPFile ($object, $objectVersion, $objectLanguage, $objectAttribute, $httpFile, $mimeData, &$result)
 
 insertRegularFile ($object, $objectVersion, $objectLanguage, $objectAttribute, $filePath, &$result)
 
 insertSimpleString ($object, $objectVersion, $objectLanguage, $objectAttribute, $string, &$result)
 
 isA ()
 
 isAddToBasketValidationRequired ()
 
 isClassAttributeRemovable ($classAttribute)
 
 isHTTPFileInsertionSupported ()
 
 isIndexable ()
 
 isInformationCollector ()
 
 isRegularFileInsertionSupported ()
 
 isSimpleStringInsertionSupported ()
 
 isTranslatable ()
 Indicates if datatype supports being translated. More...
 
 metaData ($contentObjectAttribute)
 
 objectAttributeContent ($objectAttribute)
 
 objectDisplayInformation ($objectAttribute, $mergeInfo=false)
 
 onPublish ($contentObjectAttribute, $contentObject, $publishedNodes)
 
 postInitializeObjectAttribute ($objectAttribute, $currentVersion, $originalContentObjectAttribute)
 
 postStore ($objectAttribute)
 
 postUnserializeContentObjectAttribute ($package, $objectAttribute)
 
 preStoreClassAttribute ($classAttribute, $version)
 
 preStoreDefinedClassAttribute ($classAttribute)
 
 preStoreModifiedClassAttribute ($classAttribute)
 
 preStoreVersionedClassAttribute ($classAttribute, $version)
 Hook function which is called before an content class attribute is stored. More...
 
 productOptionInformation ($objectAttribute, $optionID, $productItem)
 
 removeRelatedObjectItem ($contentObjectAttribute, $objectID)
 
 repairContentObjectAttribute ($contentObjectAttribute)
 
 restoreTrashedObjectAttribute ($objectAttribute)
 Restores the content object attribute $objectAttribute from trash Default implementation does nothing. More...
 
 resultTemplate (&$collectionAttribute)
 
 serializeContentClassAttribute ($classAttribute, $attributeNode, $attributeParametersNode)
 
 serializeContentObjectAttribute ($package, $objectAttribute)
 
 sortKey ($objectAttribute)
 
 sortKeyType ()
 
 storeClassAttribute ($classAttribute, $version)
 
 storeDefinedClassAttribute ($classAttribute)
 
 storedFileInformation ($object, $objectVersion, $objectLanguage, $objectAttribute)
 
 storeModifiedClassAttribute ($classAttribute)
 
 storeObjectAttribute ($objectAttribute)
 
 storeVersionedClassAttribute ($classAttribute, $version)
 
 supportsBatchInitializeObjectAttribute ()
 
 templateList ()
 
 title ($objectAttribute, $name=null)
 
 toString ($objectAttribute)
 
 trashStoredObjectAttribute ($objectAttribute, $version=null)
 
 unserializeContentClassAttribute ($classAttribute, $attributeNode, $attributeParametersNode)
 
 unserializeContentObjectAttribute ($package, $objectAttribute, $attributeNode)
 
 validateAddToBasket ($objectAttribute, $data, &$errors)
 
 validateClassAttributeHTTPInput ($http, $base, $classAttribute)
 
 validateCollectionAttributeHTTPInput ($http, $base, $objectAttribute)
 
 validateObjectAttributeHTTPInput ($http, $base, $objectAttribute)
 
 viewTemplate ($contentobjectAttribute)
 

Static Public Member Functions

static allowedTypes ()
 
static create ($dataTypeString)
 
static loadAndRegisterAllTypes ()
 
static loadAndRegisterType ($type)
 
static register ($dataTypeString, $className)
 
static registeredDataTypes ()
 

Public Attributes

 $DataTypeString
 The datatype string ID, used for uniquely identifying a datatype. More...
 
 $Name
 The descriptive name of the datatype, usually used for displaying to the user. More...
 

Private Member Functions

 cleanDBDataBeforeImport ()
 

Detailed Description

Base class for content datatypes.

Defines both the interface for datatypes as well as functions for registering, quering and fetching datatypes.

Each new datatype will inherit this class and define some functions as well as three templates. A datatype has three roles, it handles definition of content class attributes, editing of a content object attribute and viewing of a content object attribute. The content class attribute definition part is optional while object attribute edit and view must be implemented for the datatype to be usable.

If the datatype handles class attribute definition it must define one or more of these functions: storeClassAttribute, validateClassAttributeHTTPInput, fixupClassAttributeHTTPInput, fetchClassAttributeHTTPInput. See each function for more details. The class attribute definition usually defines the default data and/or the validation rules for an object attribute.

Object attribute editing must define these functions: storeObjectAttribute, validateObjectAttributeHTTPInput, fixupObjectAttributeHTTPInput, fetchObjectAttributeHTTPInput, initializeObjectAttribute. If the attribute wants to have a custom action it must implement the customObjectAttributeHTTPAction function. See each function for more details.

Each datatype initializes itself with a datatype string id (ezstring, ezinteger) and a descriptive name. The datatype string id must be unique for the whole system and should have a prefix, for instance we in eZ Systems use ez as our prefix.

Member Function Documentation

static eZDataType::allowedTypes ( )
static

Referenced by loadAndRegisterAllTypes().

eZDataType::attribute (   $attr)
Returns
the data for the attribute $attr or null if it does not exist.
eZDataType::attributes ( )
Returns
the attributes for this datatype.
eZDataType::batchInitializeObjectAttributeData (   $classAttribute)
eZDataType::classAttributeContent (   $classAttribute)

Returns the content data for the given content class attribute.

eZDataType::classAttributeRemovableInformation (   $classAttribute,
  $includeAll = true 
)

If the call to isClassAttributeRemovable() returns false then this can be called to figure out why it cannot be removed, e.g to give information to the user.

Returns
An array structure with information, or false if no info is available
  • text - Plain text explaining why it can't be removed
  • list - A list of reasons with details on why it can be removed
    • identifier - The identifier of the reason (optional)
    • text - Plain text explaning the reason
Parameters
$includeAllControls whether the returned information will contain all sources for not being to remove or just the first that it finds.

Referenced by isClassAttributeRemovable().

eZDataType::classDisplayInformation (   $classAttribute,
  $mergeInfo = false 
)

Will return information on how the datatype should be represented in the various display modes when used by a class.

If this method is reimplemented the implementor must call this method with the new info array as second parameter.

Parameters
$classAttributeThe content class attribute to return info for.
$mergeInfoA structure that must match the returned array, or false to ignore. Any entries here will override the default.
Returns
An array structure which contains:
  • edit
    • grouped_input - If true then the datatype has lots of input elements that should be grouped. (e.g. in a fieldset) ClassEditSettings/GroupedInput in datatype.ini is used to automatically determine this field and will override the default and datatype setting if used.
  • view
eZDataType::cleanDBDataBeforeImport ( )
private

Used by updateDBDataByDBAFile() method Must return true if successfull, or false otherwise.

Referenced by importDBDataFromDBAFile().

eZDataType::cloneClassAttribute (   $oldClassAttribute,
  $newClassAttribute 
)

Clones the date from the old class attribute to the new one.

Note
Default implementation does nothing which is good enough for datatypes which does not use external tables.
eZDataType::contentActionList (   $classAttribute)

Return content action(s) which can be performed on object containing the current datatype.

Return format is array of arrays with key 'name' and 'action'. 'action' can be mapped to url in datatype.ini

Parameters
eZContentClassAttribute$classAttribute
Returns
array
static eZDataType::create (   $dataTypeString)
static

Crates a datatype instance of the datatype string id $dataTypeString.

Note
It only creates one instance for each datatype.

Referenced by eZContentClassAttribute\cachedInfo(), eZContentObjectTreeNode\createSortingSQLStrings(), eZContentClassAttribute\dataType(), eZContentObjectAttribute\dataType(), and eZContentObjectPackageHandler\generateOverrideSettingsArray().

eZDataType::customClassAttributeHTTPAction (   $http,
  $action,
  $classAttribute 
)

Executes a custom action for a class attribute which was defined on the web page.

Note
Default implementation does nothing.
eZDataType::customObjectAttributeHTTPAction (   $http,
  $action,
  $objectAttribute,
  $parameters 
)

Executes a custom action for an object attribute which was defined on the web page.

Note
Default implementation does nothing.
eZDataType::customSorting ( )
eZDataType::customSortingSQL (   $params)
eZDataType::deleteStoredClassAttribute (   $classAttribute,
  $version = null 
)

Clean up stored class attribute

Note
Default implementation does nothing.
eZDataType::deleteStoredObjectAttribute (   $objectAttribute,
  $version = null 
)

Clean up stored object attribute

Note
Default implementation does nothing.
eZDataType::diff (   $old,
  $new,
  $options = false 
)

Method used by content diff system to retrieve changes in attributes. This method implements the default behaviour, which is to show old and new version values of the object.

eZDataType::editTemplate (   $contentobjectAttribute)
Returns
the template name to use for editing the attribute.
Note
Default is to return the datatype string which is OK for most datatypes, if you want dynamic templates reimplement this function and return a template name.
The returned template name does not include the .tpl extension.
See Also
viewTemplate, informationTemplate
eZDataType::fetchActionValue (   $action,
  $actionName,
$value 
)

Matches the action against the action name $actionName and extracts the value from the action puts it into $value.

Returns
true if the action matched and a value was found, false otherwise. If no match is made or no value found the $value parameter is not modified.

Referenced by eZObjectRelationListType\customObjectAttributeHTTPAction().

eZDataType::fetchClassAttributeHTTPInput (   $http,
  $base,
  $classAttribute 
)

Fetches the HTTP input for the content class attribute.

Note
Default implementation does nothing.
eZDataType::fetchCollectionAttributeHTTPInput (   $collection,
  $collectionAttribute,
  $http,
  $base,
  $objectAttribute 
)

Fetches the HTTP collected information for the content object attribute.

Note
Default implementation does nothing.
Returns
true if variable was successfully fetched.
eZDataType::fetchObjectAttributeHTTPInput (   $http,
  $base,
  $objectAttribute 
)

Fetches the HTTP input for the content object attribute.

Note
Default implementation does nothing.
eZDataType::fixRelatedObjectItem (   $contentObjectAttribute,
  $objectID,
  $mode 
)

Fixes objects with given ID in the relations list according to what is done with object

Note
Default implementation does nothing.
eZDataType::fixupClassAttributeHTTPInput (   $http,
  $base,
  $classAttribute 
)

Tries to do a fixup on the input text so that it's acceptable as class attribute input.

Note
Default implementation does nothing and returns accepted.
eZDataType::fixupCollectionAttributeHTTPInput (   $http,
  $base,
  $objectAttribute 
)

Tries to do a fixup on the input text so that it's acceptable as object attribute input.

Note
Default implementation does nothing.
eZDataType::fixupObjectAttributeHTTPInput (   $http,
  $base,
  $objectAttribute 
)

Tries to do a fixup on the input text so that it's acceptable as object attribute input.

Note
Default implementation does nothing.
eZDataType::fromString (   $objectAttribute,
  $string 
)
eZDataType::getDBAExtensionFilePath ( )

Returns dba-data file extension path (relative to the system root folder) for the specific datatype.

Returns
the first path that is found for the datatype. If not found, it will return false.

Referenced by getDBAFilePath().

eZDataType::getDBAFileName ( )

Returns dba-data file name of the specific datatype. This one is the default dba-data file name for all datatypes

Referenced by getDBAExtensionFilePath(), and getDBAFilePath().

eZDataType::getDBAFilePath (   $checkExtensions = true)

Returns dba-data file path (relative to the system root folder) for the specific datatype.

Referenced by importDBDataFromDBAFile().

eZDataType::handleCustomObjectHTTPActions (   $http,
  $attributeDataBaseName,
  $customActionAttributeArray,
  $customActionParameters 
)

Takes care of custom action handling, this means checking if a custom action request must be sent to a contentobject attribute. This function is only useful for datatypes that must do custom action handling for sub objects and attributes.

Note
Default implementation does nothing.
eZDataType::handleDownload (   $object,
  $objectVersion,
  $objectLanguage,
  $objectAttribute 
)

This function is called when someone tries to download the file.

Parameters
$objectThe contentobject in which the attribute is contained
$objectVersionThe current version of the object it is being worked on
$objectLanguageThe current language being worked on
$objectAttributeThe attribute which stored the file
Returns
true if any action has been don or false if hasn't.
eZDataType::hasAttribute (   $attr)
Returns
true if the attribute $attr exists in this object.
eZDataType::hasInformationCollection ( )
Returns
true if the data type can do information collection
eZDataType::hasObjectAttributeContent (   $contentObjectAttribute)
Returns
true if the datatype finds any content in the attribute $contentObjectAttribute.
eZDataType::hasStoredFileInformation (   $object,
  $objectVersion,
  $objectLanguage,
  $objectAttribute 
)

Checks if the datatype supports returning file information.

Parameters
$objectThe contentobject in which the attribute is contained
$objectVersionThe current version of the object it is being worked on
$objectLanguageThe current language being worked on
$objectAttributeThe attribute which stored the file
Returns
true if file information is supported or false if it doesn't.
eZDataType::importDBDataFromDBAFile (   $dbaFilePath = false)

Used by setup-wizard to update database data using per datatype dba file which is usually placed in share subfolder of the datatype and (share/db_data.dba) Any reimplementation of this method must return true if import is succesfully done, otherwise false.

Referenced by eZISBNType\customClassAttributeHTTPAction().

eZDataType::informationTemplate (   $contentobjectAttribute)
Returns
the template name to use for information collection for the attribute.
Note
Default is to return the datatype string which is OK for most datatypes, if you want dynamic templates reimplement this function and return a template name.
The returned template name does not include the .tpl extension.
See Also
viewTemplate, editTemplate
eZDataType::initializeClassAttribute (   $classAttribute)

Initializes the class attribute with some data.

Note
Default implementation does nothing.
eZDataType::initializeObjectAttribute (   $objectAttribute,
  $currentVersion,
  $originalContentObjectAttribute 
)

Initializes the object attribute with some data.

Note
Default implementation does nothing.
eZDataType::insertHTTPFile (   $object,
  $objectVersion,
  $objectLanguage,
  $objectAttribute,
  $httpFile,
  $mimeData,
$result 
)

Inserts the HTTP file $httpFile to the content object attribute $objectAttribute.

Parameters
$objectThe contentobject in which the attribute is contained
$objectVersionThe current version of the object it is being worked on
$objectLanguageThe current language being worked on
$objectAttributeThe attribute which will get the file
$httpFileObject of type eZHTTPFile which contains information on the uploaded file
$mimeDataMIME-Type information on the file, can be used to figure out a storage name
[out]$resultArray which will be filled with information on the process, it will contain:
  • errors - Array with error elements, each element is an array with 'description' containing the text
  • require_storage - true if the attribute must be stored after this call, or false if not required at all
Returns
true if the file was stored correctly in the attribute or false if something failed.
Note
The datatype will return null (the default) if does not support HTTP files.
$result will not be defined if the return value is null
The $httpFile must not be stored prior to calling this, the datatype will handle this internally
See Also
isHTTPFileInsertionSupported()
eZDataType::insertRegularFile (   $object,
  $objectVersion,
  $objectLanguage,
  $objectAttribute,
  $filePath,
$result 
)

Inserts the file named $filePath to the content object attribute $objectAttribute.

Parameters
$objectThe contentobject in which the attribute is contained
$objectVersionThe current version of the object it is being worked on
$objectLanguageThe current language being worked on
$objectAttributeThe attribute which will get the file
$filePathFull path including the filename
[out]$resultArray which will be filled with information on the process, it will contain:
  • errors - Array with error elements, each element is an array with 'description' containing the text
  • require_storage - true if the attribute must be stored after this call, or false if not required at all
Returns
true if the file was stored correctly in the attribute or false if something failed.
Note
The datatype will return null (the default) if does not support HTTP files.
$result will not be defined if the return value is null
See Also
isRegularFileInsertionSupported()
eZDataType::insertSimpleString (   $object,
  $objectVersion,
  $objectLanguage,
  $objectAttribute,
  $string,
$result 
)

Inserts the string $string to the content object attribute $objectAttribute.

Parameters
$objectThe contentobject in which the attribute is contained
$objectVersionThe current version of the object it is being worked on
$objectLanguageThe current language being worked on
$objectAttributeThe attribute which will get the file
$filePathFull path including the filename
[out]$resultArray which will be filled with information on the process, it will contain:
  • errors - Array with error elements, each element is an array with 'description' containing the text
  • require_storage - true if the attribute must be stored after this call, or false if not required at all
Returns
true if the file was stored correctly in the attribute or false if something failed.
Note
The datatype will return null (the default) if does not support HTTP files.
$result will not be defined if the return value is null
See Also
isSimpleStringInsertionSupported()
eZDataType::isA ( )
Returns
the data type identification string.

Referenced by createContentObjectAttributeDOMNode(), and serializeContentObjectAttribute().

eZDataType::isAddToBasketValidationRequired ( )
Returns
true if the datatype requires validation during add to basket procedure
eZDataType::isClassAttributeRemovable (   $classAttribute)

Queries the datatype if the attribute containing this datatype can be removed from the class. This can be used by datatypes to ensure that very important datatypes that could cause system malfunction is not removed. The datatype will only need to reimplemented this if it wants to do some checking, the default returns true.

Returns
true if the class attribute can be removed or false.
See Also
classAttributeRemovableInformation()
Note
The default code will call classAttributeRemovableInformation with $includeAll set to false, if it returns false or an empty 'list' it will return true.
eZDataType::isHTTPFileInsertionSupported ( )
Returns
true if the datatype support insertion of HTTP files or false (default) otherwise.
See Also
insertHTTPFile()
eZDataType::isIndexable ( )
Returns
true if the datatype can be indexed

Referenced by eZDataType().

eZDataType::isInformationCollector ( )
Returns
true if the datatype can be used as an information collector

Referenced by eZDataType().

eZDataType::isRegularFileInsertionSupported ( )
Returns
true if the datatype support insertion of files or false (default) otherwise.
See Also
insertRegularFile()
eZDataType::isSimpleStringInsertionSupported ( )
Returns
true if the datatype support insertion of simple strings or false (default) otherwise.
See Also
insertSimpleString()
eZDataType::isTranslatable ( )

Indicates if datatype supports being translated.

Returns
bool
static eZDataType::loadAndRegisterAllTypes ( )
static
static eZDataType::loadAndRegisterType (   $type)
static
eZDataType::metaData (   $contentObjectAttribute)
Returns
the text which should be indexed in the search engine. An associative array can be returned to enable searching in specific parts of the data. E.g. array( 'first_column' => "foo", 'second_column' => "bar" );
eZDataType::objectAttributeContent (   $objectAttribute)

Returns the content data for the given content object attribute.

eZDataType::objectDisplayInformation (   $objectAttribute,
  $mergeInfo = false 
)

Will return information on how the datatype should be represented in the various display modes when used by an object.

If this method is reimplemented the implementor must call this method with the new info array as second parameter.

Parameters
$objectAttributeThe content object attribute to return info for.
$mergeInfoA structure that must match the returned array, or false to ignore. Any entries here will override the default.
Returns
An array structure which contains:
  • edit
    • grouped_input - If true then the datatype has lots of input elements that should be grouped. (e.g. in a fieldset) EditSettings/GroupedInput in datatype.ini is used to automatically determine this field
  • view
  • collection
    • grouped_input - If true then the datatype has lots of input elements that should be grouped. (e.g. in a fieldset) CollectionSettings/GroupedInput in datatype.ini is used to automatically determine this field and will override the default and datatype setting if used.
  • result

Referenced by eZObjectRelationType\objectDisplayInformation(), and eZEnumType\objectDisplayInformation().

eZDataType::onPublish (   $contentObjectAttribute,
  $contentObject,
  $publishedNodes 
)

Performs necessary actions with attribute data after object is published, it means that you have access to published nodes.

Returns
True if the value was stored correctly.
Note
The method is entirely up to the datatype, for instance it could reuse the available types in the the attribute or store in a separate object.
Might be transaction unsafe.
eZDataType::postInitializeObjectAttribute (   $objectAttribute,
  $currentVersion,
  $originalContentObjectAttribute 
)

Initializes the object attribute with some data after object attribute is already stored. It means that for initial version you allready have an attribute_id and you can store data somewhere using this id.

Note
Default implementation does nothing.
eZDataType::postStore (   $objectAttribute)
eZDataType::postUnserializeContentObjectAttribute (   $package,
  $objectAttribute 
)
eZDataType::preStoreClassAttribute (   $classAttribute,
  $version 
)

Similar to the storeClassAttribute but is called before the attribute itself is stored and can be used to set values in the class attribute.

Returns
True if the value was stored correctly.
See Also
fetchClassAttributeHTTPInput

Referenced by preStoreDefinedClassAttribute(), and preStoreModifiedClassAttribute().

eZDataType::preStoreDefinedClassAttribute (   $classAttribute)
Parameters
eZContentClassAttribute$classAttributeContent class attribute of the datatype

Referenced by preStoreVersionedClassAttribute().

eZDataType::preStoreModifiedClassAttribute (   $classAttribute)
Parameters
eZContentClassAttribute$classAttributeContent class attribute of the datatype

Referenced by preStoreVersionedClassAttribute().

eZDataType::preStoreVersionedClassAttribute (   $classAttribute,
  $version 
)

Hook function which is called before an content class attribute is stored.

See Also
eZContentClassAttribute::storeVersioned()
Parameters
eZContentClassAttribute$classAttributeContent class attribute of the datatype
int$versionVersion of the attribute to be stored
eZDataType::productOptionInformation (   $objectAttribute,
  $optionID,
  $productItem 
)

Fetches the product option information for option with ID $optionID and returns this information. This will be called from the basket when a new product with an option is added, it is then up to the specific datatype to return proper data. It will also be used to recalcuate prices.

Parameters
$objectAttributeThe attribute that the datatype controls.
$optionIDThe ID of the option which information should be returned from.
$productItemThe product item object which contains the option, is available for reading only.
Returns
An array structure which contains:
  • id - The unique ID of the selected option, this must be unique in the attribute and will later on be used to recalculate prices.
  • name - The name of the option list
  • value - The display string of the selected option
  • additional_price - A value which is added to the total product price, set to 0 or false if no price is used. If the option could not be found it should return false, if not supported it should return null.
See Also
handleProductOption
static eZDataType::register (   $dataTypeString,
  $className 
)
static

Registers the datatype with string id $dataTypeString and class name $className. The class name is used for instantiating the class and should be in lowercase letters.

static eZDataType::registeredDataTypes ( )
static
Returns
a list of datatypes which has been registered.
Note
This will instantiate all datatypes.

Referenced by eZStepCreateSites\initializePackage().

eZDataType::removeRelatedObjectItem (   $contentObjectAttribute,
  $objectID 
)

Removes objects with given ID from the relations list

Note
Default implementation does nothing.
eZDataType::repairContentObjectAttribute (   $contentObjectAttribute)

Tries to do a repair on the content object attribute $contentObjectAttribute and returns true if it succeeds.

Returns
false if it fails or null if it is not supported to do a repair.
eZDataType::restoreTrashedObjectAttribute (   $objectAttribute)

Restores the content object attribute $objectAttribute from trash Default implementation does nothing.

Parameters
eZContentObjectAttribute$objectAttribute
eZDataType::resultTemplate ( $collectionAttribute)
Returns
the template name to use for result view of an information collection attribute.
Note
Default is to return the datatype string which is OK for most datatypes, if you want dynamic templates reimplement this function and return a template name.
The returned template name does not include the .tpl extension.
$collectionAttribute can in some cases be a eZContentObjectAttribute, so any datatype that overrides this must be able to handle both types.
eZDataType::serializeContentClassAttribute (   $classAttribute,
  $attributeNode,
  $attributeParametersNode 
)

Adds the necessary dom structure to the attribute parameters.

Note
The default is to add unsupported='true' to the attribute node, meaning that the datatype does not support serializing.
eZDataType::serializeContentObjectAttribute (   $package,
  $objectAttribute 
)
Parameters
package
objectAttributecontent attribute
Returns
a DOM representation of the content object attribute
eZDataType::sortKey (   $objectAttribute)
Returns
the sort key for the datatype. This is used for sorting on attribute level.
eZDataType::sortKeyType ( )
Returns
the type of the sort key int|string False is returned if sorting is not supported
eZDataType::storeClassAttribute (   $classAttribute,
  $version 
)

Stores the datatype data to the database which is related to the class attribute. The $version parameter determines which version is currently being stored, 0 is the real version while 1 is the temporary version.

Returns
True if the value was stored correctly.
Note
The method is entirely up to the datatype, for instance it could reuse the available types in the the attribute or store in a separate object.
This function is called after the attribute data has been stored. If you need to alter attribute data use preStoreClassAttribute instead.
See Also
fetchClassAttributeHTTPInput
eZDataType::storeDefinedClassAttribute (   $classAttribute)
Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.
Parameters
eZContentClassAttribute$classAttributeContent class attribute of the datatype

Referenced by storeVersionedClassAttribute().

eZDataType::storedFileInformation (   $object,
  $objectVersion,
  $objectLanguage,
  $objectAttribute 
)

Returns file information for the filed stored by the attribute.

Parameters
$objectThe contentobject in which the attribute is contained
$objectVersionThe current version of the object it is being worked on
$objectLanguageThe current language being worked on
$objectAttributeThe attribute which stored the file
Returns
An array structure with information or false (default) if no information could be found. The structure must contain:
  • filepath - The full path to the file

The structure can contain:

  • filename - The name of the file, if not supplied it will be figured out from the filepath
  • filesize - The size of the file, if not supplied it will be figured out from the filepath
  • mime_type - The MIME type for the file, if not supplied it will be figured out from the filepath
eZDataType::storeModifiedClassAttribute (   $classAttribute)
Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.
Parameters
eZContentClassAttribute$classAttributeContent class attribute of the datatype

Referenced by storeVersionedClassAttribute().

eZDataType::storeObjectAttribute (   $objectAttribute)

Stores the datatype data to the database which is related to the object attribute.

Returns
True if the value was stored correctly.
Note
The method is entirely up to the datatype, for instance it could reuse the available types in the the attribute or store in a separate object.
See Also
fetchObjectAttributeHTTPInput
eZDataType::storeVersionedClassAttribute (   $classAttribute,
  $version 
)
Note
Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.
Parameters
eZContentClassAttribute$classAttributeContent class attribute of the datatype
int$versionVersion of the attribute to be stored
eZDataType::supportsBatchInitializeObjectAttribute ( )
eZDataType::templateList ( )

Can be called to figure out if a datatype has certain special templates that it relies on. This can for instance be used to figure out which override templates to include in a package.

Returns
An array with template files that this datatype relies on. Each element can be one of the following types:
  • string - The filepath of the template
  • array - Advanced matching criteria, element 0 determines the type:
    • 'regexp' - A regular expression, element 1 is the regexp string (PREG) If false is returned it means there are no relations to any templates.
Note
All matching is done relative from templates directory in the given design.
The templates that are found in content/datatype/* should not be included.
eZDataType::title (   $objectAttribute,
  $name = null 
)

Returns the title of the current type, this is to form the title of the object.

eZDataType::toString (   $objectAttribute)
Returns
string representation of an contentobjectattribute data for simplified export
eZDataType::trashStoredObjectAttribute (   $objectAttribute,
  $version = null 
)

Do any necessary changes to stored object attribute when moving an object to trash.

Note
Default implementation does nothing.
eZDataType::unserializeContentClassAttribute (   $classAttribute,
  $attributeNode,
  $attributeParametersNode 
)

Extracts values from the attribute parameters and sets it in the class attribute.

Note
This function is called after the attribute has been stored and a second store is called after this function is done.
eZDataType::unserializeContentObjectAttribute (   $package,
  $objectAttribute,
  $attributeNode 
)

Unserialize contentobject attribute

Parameters
package
objectAttributecontentobject attribute object
attributeNodeezdomnode object
eZDataType::validateAddToBasket (   $objectAttribute,
  $data,
$errors 
)

Validates the input for an object attribute during add to basket process and returns a validation state as defined in eZInputValidator.

Note
Default implementation does nothing and returns accepted.
eZDataType::validateClassAttributeHTTPInput (   $http,
  $base,
  $classAttribute 
)

Validates the input for a class attribute and returns a validation state as defined in eZInputValidator.

Note
Default implementation does nothing and returns accepted.
eZDataType::validateCollectionAttributeHTTPInput (   $http,
  $base,
  $objectAttribute 
)

Validates the input for an object attribute and returns a validation state as defined in eZInputValidator.

Note
Default implementation does nothing and returns accepted.
eZDataType::validateObjectAttributeHTTPInput (   $http,
  $base,
  $objectAttribute 
)

Validates the input for an object attribute and returns a validation state as defined in eZInputValidator.

Note
Default implementation does nothing and returns accepted.
eZDataType::viewTemplate (   $contentobjectAttribute)
Returns
the template name to use for viewing the attribute.
Note
Default is to return the datatype string which is OK for most datatypes, if you want dynamic templates reimplement this function and return a template name.
The returned template name does not include the .tpl extension.
See Also
editTemplate, informationTemplate

Member Data Documentation

eZDataType::$Name

The descriptive name of the datatype, usually used for displaying to the user.


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