Message-ID: <1477466127.3770.1485855274286.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3769_1142004312.1485855274286" ------=_Part_3769_1142004312.1485855274286 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
At this point, we have an =E2=80=9Canonymous=E2=80=9D Symfony 2 bundle.<= strong>
Let=E2=80=99s start by creating the structure for our Field Type. To mak=
e it easier to move around the code, we will to some extent mimic the struc=
ture that is used in the kernel. Native Field Types are located inside vendor/ezsystems
), in the =
eZ/Publish/Core/FieldType
folder. Each Field Type has its own subfo=
lder: TextLine
, Email
, Url
, etc. =
We will use a structure quite close to this.
From the tutorial repository, list the contents of the eZ/Publish=
/FieldType
folder:
eZ
=E2=94=94=E2=94=80=E2=94=80 Publish
=E2=94=94= =E2=94=80=E2=94=80 FieldType
=E2=94=94=E2=94= =80=E2=94=80 Tweet
=E2=94=9C= =E2=94=80=E2=94=80 Type.php
= =E2=94=94=E2=94=80=E2=94=80 Value.php
We have the two base classes required by a Field Type: Type and
Value
.
The Type contains the logic of the Field Type: validating data, transfor=
ming from various formats, describing the validators, etc.
A Type class=
must implement eZ\Publish\SPI\FieldType\FieldType
. It may a=
lso extend the eZ\Publish\Core\FieldType\FieldType
abstract c=
lass.
The Value is used to represent an instance of our type within a Content =
item. Each Field will present its data using an instance of the Type=E2=80=
=99s Value class.
A value class must implement the eZ\Publish\SP=
I\FieldType\Value
interface. It may also extend the eZ\Publi=
sh\Core\FieldType\Value
abstract class.