eZ Systems Website
  Editor documentation

  Developer documentation

  Back to the top

The documentation is moving!

We're moving our developer docs to Github and a new site.
The migration is still in progress, so please contact us in #documentation-contrib on eZ Community Slack if you have any questions or feedback.

This space will not be updated from now on except for critical fixes.

Skip to end of metadata
Go to start of metadata

This Field Type validates and stores structured rich text, and exposes it in several formats.

NameInternal nameExpected input

PHP API Field Type 

Input expectations

XML document in one of the Field Type's input formats as a string.See the example below.

XML document in one of the Field Type's input formats as a

DOMDocument object.

See the example below.
An instance of the Field Type's Value object.See the example below.
Input formats

Field Type works with XML and also expects an XML value as input, whether as a string, DOMDocument object or Field Type's Value object. When the value is given as a string or a DOMDocument object, it will be checked for conformance with one of the supported input formats, then dispatched to the appropriate converter, to be converted to the Field Type's internal format. No conversion will be performed if providing the value in Field Type's internal format or as Field Type's Value object. In the latter case it will be expected that Value object holds the value in Field Type's internal format.

Currently supported input formats are described in the table below:

eZ Publish Docbook variantFieldType's internal format
XHTML5 editing formatTypically used with in-browser HTML editor
Legacy eZXML formatCompatibility with legacy eZXML format, used by  XmlText Field Type
Example of the Field Type's internal format
Example of the Field Type's XHTML5 edit format

This format is used by eZ Platform Online Editor and will change with its needs as we continue to evolve this part of the UI.

For more information about internal format and input formats, see Field Type's conversion test fixtures on GitHub.

For example, ezxml does not use explicit level attributes for <header> elements, instead <header> element levels are indicated through the level of nesting inside <section> elements.

Example of using XML document in internal format as a string

Value object

eZ\Publish\Core\FieldType\RichText\Value offers following properties:

Internal format value as an instance of DOMDocument.

REST API specifics

Creating or updating Content

When creating RichText content with the REST API, it is possible to provide data as a string, using the "xml" fieldValue key:

When the value given over REST API is transformed into a Field Type's Value object, it will be treated as a string. This means you can use any supported input format for input over REST API.