9
Building custom field types Edi Modrić ( @emodric ) https://github.com/emodric/EzscIpAddressBundle

eZ Publish Summer Camp 2013 - Building custom field types

Embed Size (px)

Citation preview

Page 1: eZ Publish Summer Camp 2013 - Building custom field types

Building custom field

types

Edi Modrić ( @emodric )

https://github.com/emodric/EzscIpAddressBundle

Page 2: eZ Publish Summer Camp 2013 - Building custom field types

About me

• Edi Modrić

• Computer engineering masters degree

• Working at Netgen for 6 years

• 5 years of eZ Publish development

• Certified eZ Publish developer

• eZ Tags maintainer

• Collaborated with eZ Systems on eZ Publish 5 kernel

• @emodric

[email protected]

Page 3: eZ Publish Summer Camp 2013 - Building custom field types

Agenda

• A little bit of theory

• Coding a simple field type

• Verifying that it works

Page 4: eZ Publish Summer Camp 2013 - Building custom field types

The code

$ cd /var/www/ezpublish/src/

$ mkdir Netgen && cd Netgen

$ git clone git://github.com/emodric/EzscIpAddressBundle.git

Page 5: eZ Publish Summer Camp 2013 - Building custom field types

Datatype + public API = field type

• Content class = Content type

• Content object = Content

• Content class attribute = Field definition

• Content object attribute = Field

• Object attribute content = Field value

• Datatype = Field type

Page 6: eZ Publish Summer Camp 2013 - Building custom field types

Field type components

• Main field type implementation

• Field type value

• Per storage converters

Page 7: eZ Publish Summer Camp 2013 - Building custom field types

Field type storage

• Internal storage

• Stores data to ezcontentobject_attribute DB table

• External storage

• Custom database tables

• Anything else

Page 8: eZ Publish Summer Camp 2013 - Building custom field types

What about legacy stack?

• Legacy datatypes are not going anywhere

• No admin interface based on Symfony stack

• To actually use your field type, you WILL need legacy

datatype

Page 9: eZ Publish Summer Camp 2013 - Building custom field types

Field type vs. datatype

• No difference in functionality

• Advantages over datatypes

• Clear separation of concerns

• No POST variables

• No SQL

• No file uploads

• More readable and understandable code