Skip to the content
Documentation

The XmlText Field Type: comparison of v.2 vs v.3

No ratings yet

Versions Compared

Old Version 2

changes.mady.by.user Bertrand Dunogier

Saved on Dec 15, 2015

compared with

New Version Current

changes.mady.by.user Dominika Kurek

Saved on Jan 28, 2016

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning
The XmlText fieldtype Field Type isn't officially supported by eZ Platform. It can be installed by requiring ezsystems/ezplatform-xmltext-fieldtype. PlatformUI does not support wysiwyg editing of this type of Field.

This FieldType Field Type validates and stores formatted text using the Exponential legacy format, ezxml. 

...

Table of Contents
minLevel 2

Input expectations

Type Description Example
string XML document in the FieldType Field Type internal format as a string. See the example below.
eZ\Publish\Core\FieldType\XmlText\Input
An instance of the class implementing FieldType Field Type abstract Input class. See the example below.
eZ\Publish\Core\FieldType\XmlText\Value
An instance of the FieldType Field Type Value object. See the example below.

Example of the FieldTypeField Type's internal format

Code Block
language xml
linenumbers true
<?xml version="1.0" encoding="utf-8"?>
<section
	xmlns:custom="http://ez.no/namespaces/exponential3/custom/"
	xmlns:image="http://ez.no/namespaces/exponential3/image/"
	xmlns:xhtml="http://ez.no/namespaces/exponential3/xhtml/">
    <paragraph>This is a paragraph.</paragraph>
</section>

For XHTML Input

The eZ XML output use uses <strong> and <em> by default, respecting the semantic XHTML notation.

Info
icon false
title Learn more about <strong>, <b>, <em>, <i>

Input object API

Input object is intended as a vector for different input formats. It should accept input value in a foreign format and convert it to the FieldTypeField Type's internal format.

It should implement abstract eZ\Publish\Core\FieldType\XmlText\Input class, which defines only one method:

...

Code Block
language php
title Example of using the Input object
linenumbers true
...

use eZ\Publish\Core\FieldType\XmlText\Input\EzXml as EzXmlInput;

...

$contentService = $repository->getContentService();
$contentTypeService = $repository->getContentTypeService();

$contentType = $contentTypeService->loadContentTypeByIdentifier( "article" );
$contentCreateStruct = $contentService->newContentCreateStruct( $contentType, "eng-GB" );

$inputString = <<<EZXML
<?xml version="1.0" encoding="utf-8"?>
<section
	xmlns:custom="http://ez.no/namespaces/exponential3/custom/"
	xmlns:image="http://ez.no/namespaces/exponential3/image/"
	xmlns:xhtml="http://ez.no/namespaces/exponential3/xhtml/">
    <paragraph>This is a paragraph.</paragraph>
</section>
EZXML;

$ezxmlInput = new EzXmlInput( $inputString );

$contentCreateStruct->setField( "description", $ezxmlInput );

...

Value object API

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

Property Type Description
xml
DOMDocument
Internal format value as an instance of DOMDocument.

Validation

Validation of the internal format is performed in the eZ\Publish\Core\FieldType\XmlText\Input\EzXml class.

...

Name Type Default value Description
numRows int 10 Defines the number of rows for the online editor in the administration interface.
tagPreset mixed Type::TAG_PRESET_DEFAULT Preset of tags for the online editor in the administration interface.

Tag presets

Following tag presets are available as constants in the eZ\Publish\Core\FieldType\XmlText class:

...

Comments

Add a comment

Comments are read by a moderator before they appear.