Message-ID: <1633186221.3530.1485853509584.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3529_1076180696.1485853509584" ------=_Part_3529_1076180696.1485853509584 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Let=E2=80=99s start by creating the s=
tructure for our FieldType. To make it easier to move around the code, we w=
ill mimic to some extent the structure that is used in the kernel. Native FieldTypes are located inside=
ezpublish-kernel
(in vendor/ezsystems
), in the <=
/span>eZ/Publish/Core/FieldType
folder. Each FieldType has i=
ts own subfolder: TextLine<=
/span>
, Email
, Url
=E2=80=A6 we will use a structure quite close=
from this.
From the tutorial repository, list the contents of the 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 FieldType: Type
and Value
=
.
The Type contains the logic =
of the field type: validating data, transforming from various formats, desc=
ribing the validators=E2=80=A6
A type class must implement eZ\Publish\SPI\FieldType\FieldType
. It may also extend the eZ\Publish\Core\FieldType\FieldType
abstract class.
The Value is used to represe=
nt an instance of our type within a Content item. Each Field will present i=
ts data using an instance of the Type=E2=80=99s Value class.eZ\Publish\Core\FieldType\=
Value
abstract class.