Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

The eZDataType API

Every eZDataType method a datatype overrides, grouped by purpose - registration, editing, storage, class settings, collection, search and sorting, import, packages - with kernel signatures.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/extension-development/part-8-reference/ezdatatype-api.md

On this page

The eZDataType API

Part 8, reference 16. A datatype is a class that extends eZDataType (kernel/classes/ezdatatype.php) and overrides the methods it needs. This page lists them by purpose, with the signatures of the base class (copy them exactly: PHP 8 refuses an override whose signature differs). How to build one is in Datatypes, Datatype storage, validation and templates and the tutorials A datatype, by hand and With RAD: a datatype.

Registration

MethodNotes
public function __construct( $dataTypeString, $name, $properties = array() )call it from your constructor with your datatype string and translated name
static function register( $dataTypeString, $className )call once at the end of the file: eZDataType::register( 'mydatatype', 'myDataTypeType' );

Plus content.ini [DataTypeSettings] ExtensionDirectories[] and AvailableDataTypes[].

Editing an object's attribute

MethodCalled when
initializeObjectAttribute( $objectAttribute, $currentVersion, $originalContentObjectAttribute )a new version is created: copy or set defaults
validateObjectAttributeHTTPInput( $http, $base, $objectAttribute )the edit form is posted; return eZInputValidator::STATE_ACCEPTED or STATE_INVALID
fetchObjectAttributeHTTPInput( $http, $base, $objectAttribute )after validation: read the posted value into the attribute; return true if something was read
customObjectAttributeHTTPAction( $http, $action, $objectAttribute, $parameters )a custom button of your edit template was pressed

The posted field names follow the kernel's convention of base, datatype string, field and attribute ID: ezstring reads $base . '_ezstring_data_text_' . $contentObjectAttribute->attribute( 'id' ). Your edit template must post exactly the names your class reads.

Storage and content

MethodUse
storeObjectAttribute( $objectAttribute )before the attribute row is stored
objectAttributeContent( $objectAttribute )what $attribute.content is in templates and attribute( 'content' ) in PHP
hasObjectAttributeContent( $contentObjectAttribute )whether the attribute is filled
onPublish( $contentObjectAttribute, $contentObject, $publishedNodes )when the version is published
deleteStoredObjectAttribute( $objectAttribute, $version = null )before the stored data is removed (delete files you stored)

Class settings

MethodUse
validateClassAttributeHTTPInput( $http, $base, $classAttribute )the class edit form is posted
fetchClassAttributeHTTPInput( $http, $base, $classAttribute )read the class-level settings
storeClassAttribute( $classAttribute, $version )before the class attribute is stored
classAttributeContent( $classAttribute )what $class_attribute.content is

Information collection

MethodUse
isInformationCollector()return true if the attribute can collect input from visitors
validateCollectionAttributeHTTPInput( $http, $base, $objectAttribute )validate a visitor's input
fetchCollectionAttributeHTTPInput( $collection, $collectionAttribute, $http, $base, $objectAttribute )store it

Search, sorting, naming

MethodUse
isIndexable()whether the search engine indexes it
metaData( $contentObjectAttribute )the text to index
sortKey( $objectAttribute ), sortKeyType()the value and type ('int' or 'string') for sorting by this attribute
title( $objectAttribute, $name = null )the text used in object names

Import, export, packages

MethodUse
toString( $objectAttribute ), fromString( $objectAttribute, $string )the attribute as a string, for imports, exports and some tools
serializeContentClassAttribute( $classAttribute, $attributeNode, $attributeParametersNode ), unserializeContentClassAttribute( ... )the class settings in a package

Templates

A datatype draws nothing without its templates, found through the design chain: content/datatype/view/<datatypestring>.tpl and content/datatype/edit/<datatypestring>.tpl, plus class/datatype/view/ and class/datatype/edit/ for class settings. The extension needs design.ini [ExtensionSettings] DesignExtensions[] so they are found.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x