General

  eZ Systems Website
  Editor documentation


  Developer documentation

  Back to the top

Skip to end of metadata
Go to start of metadata

Custom Field Types follow the Symfony 2 extension mechanism: bundles. We can get started with a bundle using the built-in Symfony 2 bundle generator.

Generating the bundle

From the eZ Platform root, run the following:

First, we are asked for the namespace. As the vendor, we will use EzSystems as the root namespace. This must of course be changed to whatever identifies you as a vendor (your name, company name, etc). We then choose a preferably unique name for the Field Type itself, and make the name end with Bundle. Here we’ve chosen TweetFieldTypeBundle.

 

We must next input the bundle’s name. Nothing exotic here: we concatenate the vendor’s namespace and the bundle’s namespace, which is the default. Just hit Enter:

We are then asked for the target directory. We will begin within the src folder, but we could (and should!) version it and have it moved to vendor at some point. Again, this is the default, and we just hit Enter.

We must then specify which format the configuration must be generated as. We will use yml, since it is what we use in eZ Platform itself. Of course, any other format could be used.

The generator will then offer to create the whole directory structure for us. Since our bundle isn’t really a standard Symfony full stack bundle, we decline.

 

We then get a summary of what will be generated:

After generation, the wizard will offer to update the kernel with our bundle (answer "yes"), and to update the app’s routing with our bundle’s route file (answer "no").

Our bundle should now be generated. Navigate to src/EzSystems/EzSystemsTweetBundle and you should see the following structure:

Feel free to delete the Controller folder, since we won’t use it in this tutorial. It could have been useful, had our Field Type required an interface of its own.

Tutorial path