Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27344

Custom Field Type creation requires creating Twig settings block

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Medium Medium
    • 1.10.0-rc1
    • 1.9.0
    • Field types
    • 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:

      1. Clone https://github.com/ezsystems/TweetFieldTypeBundle to eZ Platform project and add this as a bundle to AppKernel class.
      2. 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.
      3. 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.").""

      Attachments

        Activity

          People

            Unassigned Unassigned
            jacek.foremski-obsolete@ez.no Jacek Foremski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: