Step 2 - Define the Point 2D Field Type¶
Tip
You can find all files used and modified in this step on GitHub.
The Type class¶
The Type contains logic of the Field Type: validating data, transforming from various formats, describing the validators, etc.
In this example Point 2D Field Type will extend the eZ\Publish\SPI\FieldType\Generic\Type
class.
For more information about the Type class of a Field Type, see Type class.
Field Type identifier¶
First, create src/FieldType/Point2D/Type.php
.
Add a getFieldTypeIdentifier()
method to it. The new method will return the string that uniquely identifies your Field Type, in this case point2d
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Add a new service definition¶
Next, add the ezplatform.field_type
tag to config/services.yaml
:
1 2 3 4 5 |
|