Details
-
Improvement
-
Resolution: Fixed
-
Medium
-
1.9.0
-
None
Description
Currently creating custom Field Type requires creating Twig file with settings block like this one from the tutorial: https://github.com/ezsystems/TweetFieldTypeBundle/blob/master/Resources/views/platformui/content_type/view/eztweet.html.twig. It is required regardless of whether developer wants to implement some custom settings or not.
In my opinion, it shouldn't be required if there are no settings because it unnecessarily complicates the creation of simple Field Types. Also, it should be consistent with field_definition_edit Twig block and currently this block is not required if the developer doesn't want to implement something more advanced, like a validator.
Steps to reproduce:
- Clone https://github.com/ezsystems/TweetFieldTypeBundle to eZ Platform project and add this as a bundle to AppKernel class.
- Delete Resources/views/platformui/content_type/view/eztweet.html.twig file from this bundle and remove "fielddefinition_settings_templates" entry from Resources/config/ez_field_templates.yml file, also from this bundle.
- Try to create new Content Type with Twitter Field Type as one of the fields. After clicking "OK" you should see an error on the bottom saying something like
"Failed to load 'http://ezplatform.dev/pjax/contenttype/view/22/eng-GB'".
In the logs, the error will look like this:
"request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Cannot find 'eztweet_settings' template block.").""