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

Simplify doc : FormMapper for Datatype uses obscure syntax

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Medium Medium
    • n/a
    • 3.2.2
    • Documentation
    • None

    Description

      In documentation for fieldtype we uses the getFormFactory() in mapFieldValueForm() and mapFieldDefinitionForm()

      I don't quite understand the comment "// Creating from FormBuilder as we need to add a DataTransformer.". No DataTransformer is added in that example.
      If you need a data transformer, I think it is good practice to then add that in your FormType, in the buildForm() method. How to add a datatransformer seems to be missing from our documentation actually.

      AFAIK, there is no benefits for doing that this complex, so we can just add the FormType as we do in the tutorial:
      https://doc.ibexa.co/en/latest/tutorials/generic_field_type/6_settings/#define-field-type-format
      https://doc.ibexa.co/en/latest/tutorials/generic_field_type/6_settings/#fielddefinitionformmapper-interface

      In the special case where don't want to create your own FormType, but use a one of ours or Symfony's, and you need to use a datatransformer, then you may use the factory and addModelTransformer() here directly in mapFieldDefinitionForm() but the example in the doc does not do that.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vidar.langseid@ibexa.co Vidar Langseid
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: