General

  eZ Systems Website
  Technical documentation
  Editor documentation

This Documentation contains:
 
Technical documentation:



⚠ WARNING ! This documentation is deprecated !

Please go to the current Technical Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

At this point, we have an “anonymous” Symfony 2 bundle.  

Let’s start by creating the structure for our FieldTypeField Type. To make it easier to move around the code, we will mimic to some extent mimic the structure that is used in the kernel.   Native FieldTypes Field Types are located inside ezpublish-kernel (in vendor/ezsystems), in the eZ/Publish/Core/FieldType folder. Each FieldType Field Type has its own subfolder: TextLine, Email, Url… we , etc. We will use a structure quite close from to this.

 From the tutorial repository, list the contents of the eZ/Publish/FieldType folder:

 eZ
└── Publish
   └──  └── FieldType
       └── Tweet
           ├── Type.php
           └── Value.php

We have the two base classes required by a FieldTypeField Type: Type and Value.

The Type class

The Type contains the logic of the field typeField Type: validating data, transforming from various formats, describing the validators…validators, etc.
A type Type class must implement eZ\Publish\SPI\FieldType\FieldType . It may also extend the eZ\Publish\Core\FieldType\FieldType abstract class.

The Value class

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’s Value class.
A value class must implement the eZ\Publish\SPI\FieldType\Value interface. It may also extend the eZ\Publish\Core\FieldType\Value abstract class.