Message-ID: <1052512283.4148.1485857868804.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_4147_952548503.1485857868804" ------=_Part_4147_952548503.1485857868804 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html XmlText Field Type

XmlText Field Type

=20
=20
=20
=20

The XmlText Field Type isn't officially supported by eZ Platform. It can= be installed by requiring ezsystems/ezplatform-xmltext-fieldtype. Platform= UI does not support wysiwyg editing of this type of Field.


This Field Type validates and stores = formatted text using the eZ Publish legacy format, ezxml. 

Name Internal name Expected input
XmlText ezxmltext mixed

Input expectations

Type Description Example
string XML document in the Field Type internal format a= s a string.

See the example below.

eZ\Publish\Core\FieldType\XmlText\Inp=
ut
An instance of the class implementing Field Type= abstract Input class. See the example below.
eZ\Publish\Core\FieldType\XmlText\Value
An instance of the Field Type Value object. See the example below.

Example o= f the Field Type's internal format

=20
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<section
=09xmlns:custom=3D"http://ez.no/namespaces/ezpublish3/custom/"
=09xmlns:image=3D"http://ez.no/namespaces/ezpublish3/image/"
=09xmlns:xhtml=3D"http://ez.no/namespaces/ezpublish3/xhtml/">
    <paragraph>This is a paragraph.</paragraph>
</section>
=20

For XHTML Input

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


Input object API

Input o= bject is intended as a vector for different input formats. It should accept= input value in a foreign format and convert it to the Field Type's interna= l format.

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

Method Description
getInternalRepresentation
The method should return the input value in the = internal format.

At the moment there is only one imple= mentation of the Input class, eZ\Publish\Core\FieldType\XmlText\Input\EzXml, which accepts input value in the interna= l format, and therefore only performs validation of the input value.=

Example of using the Input object
=20
...
 
use eZ\Publish\Core\FieldType\XmlText\Input\EzXml as EzXmlInput;

...

$contentService =3D $repository->getContentService();
$contentTypeService =3D $repository->getContentTypeService();
 
$contentType =3D $contentTypeService->loadContentTypeByIdentifier( "arti=
cle" );
$contentCreateStruct =3D $contentService->newContentCreateStruct( $conte=
ntType, "eng-GB" );

$inputString =3D <<<EZXML
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<section
=09xmlns:custom=3D"http://ez.no/namespaces/ezpublish3/custom/"
=09xmlns:image=3D"http://ez.no/namespaces/ezpublish3/image/"
=09xmlns:xhtml=3D"http://ez.no/namespaces/ezpublish3/xhtml/">
    <paragraph>This is a paragraph.</paragraph>
</section>
EZXML;
 
$ezxmlInput =3D new EzXmlInput( $inputString );

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

Value object API

eZ\Publish\Core\FieldType\XmlText\Value&nb= sp;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.

Settings

Following settings are available:

Name Type Default value Description

n= umRows

int 10 Defines the number of rows for the online editor= in the administration interface.

t= agPreset

mixed Type::TAG_PRESET_DEFAULT

Preset of tags for the online editor in= the administration interface.

Tag presets

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

Constant Description
TAG_PRESET_DEFAULT
Default tag preset.
TAG_PRESET_SIMPLE_FORMATTING

Preset of tags for online editor intend= ed for simple formatting options.

Example of using settings in PHP
=20
...
 
use eZ\Publish\Core\FieldType\XmlText\Type;

...

$contentTypeService =3D $repository->getContentTypeService();
$xmltextFieldCreateStruct =3D $contentTypeService->newFieldDefinitionCre=
ateStruct( "description", "ezxmltext" );

$xmltextFieldCreateStruct->fieldSettings =3D array(
=09"numRows" =3D> 25,
=09"tagPreset" =3D> Type::TAG_PRESET_SIMPLE_FORMATTING
);
 
...
=20
=20
=20
=20
=20

 

=20
=20
=20
------=_Part_4147_952548503.1485857868804--