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

Change configuration of RichText field type

    Details

      Description

      In https://github.com/ezsystems/ezpublish-kernel/pull/1926 a new naming has been proposed, and we need to reflect this on the setting as well.

      Given custom tags have not been exposed yet in the product we can do this, but we should still add a BC note + upgrade note about the change.

      Today:

      ezrichtext:
       
          # Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".
          output_custom_tags:
       
          # Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".
          edit_custom_tags:
       
          # Custom XSL stylesheets to use for RichText transformation to HTML5. Useful for "custom tags".
          input_custom_tags:
       
          # RichText template tags configuration.
          tags:
               key:
      

      Suggestion for discussion for this milestone:

      ezrichtext:
       
          # Simple custom template tags (xhtml5output twig template & attribute info) 
          custom_template_tags:
       
              # Prototype: Name of RichText template tag.
              # 'default' and 'default_inline' tag names are reserved for fallback.
              key:
       
                   # Template used for rendering RichText template tag.
                  template:
       
                   # Block mode, default is "block", alternative is "inline", for use by editor
                   block_mode:
       
                   # Tag configuration, arbitrary configuration is allowed here.
                   config:               ~
       
                   # Map of attributes
                   attributes:
                      # Prototype: Name of RichText custom attribute tag.
                      # Name is generated using keys and trasnlation system
                       key:
                           # Html Input Type (string, number, email, date, ...., but file, image, button, radio, reset, submit & checkbox not supported)
                           type: (string)
       
                           # Field is required
                           required: (bolean)
       
                           # Default value
                           value: (scalar)
       
                          ## TBD, might be milestone2, but these are native html5 concepts:
                          min: (scalar)
                          max: (scalar)
                          maxlength: (number)
                          minlength
                          pattern: (scalar)
                          size: (number)
                          # placeholder should use translation system?
       
       
                           
      

      Future milestone:

      ezrichtext:
       
          # Custom dockbook tags (XSL stylesheets & attribute info) 
          custom_dockbook_tags:
       
             # Prototype: Name of RichText template tag.
             # 'default' and 'default_inline' tag names are reserved for fallback.
             key:
                  # XSLT for translating storage format to ouput format (optional)
                  xslt_from_docbook_to_xhtml5output:
       
                  # XSLT for translating storage format to edit format (optional)
                  xslt_from_docbook_to_xhtml5edit:
       
                  # XSLT for translating edit format to storage format (optional)
                  xslt_from_xhtml5edit_to_docbook:
       
                   # Schema information is xsd or preferably in rng format.
                   schema:
       
                   # Tag configuration, arbitrary configuration is allowed here.
                   config:               ~
       
                   # Priority in the loading order. A high value will have higher precedence in overriding XSL templates.
                   priority:
      

      Open questions:
      1. Implied in suggested config structure there might be a custom template tag and custom docbook tag with same name, so we need to check if that is ok at all (this will for instance be an issue if there is a general block about adding classes to tags, or a need to identify tags by name if it does not get prefixed somehow)
      2. For output rendering, how to handle custom php logic when needed? (check how it is done currently and how it might be made extendable if it isn't already)
      3. Definition of custom attributes, and the implications that it should be used for server side validation before xsl transformation to storage format.
      4. Config for CSS for the tags would be needed to have some configuration somewhere, but might not be needed if it can be already done by registering css/js to be loaded using existing platform ui config
      5. ...

        Activity

        Hide
        Bertrand Dunogier added a comment - - edited

        About the configuration suggested above, I have a suggestion that would clear out the risk of a tag being both template & docbook:

        ezrichtext:
            custom_tags:
                <name>:
                    # If this is set, the tag is a template one
                    template: 'path/to/template.html.twig'
         
                    # Inline is false by default
                    inline: false
         
                    # If these are set, the tag is a docbook one
                    xslt_from_docbook_to_xhtml5output: ...
                    xslt_from_docbook_to_xhtml5edit: ...
                    xslt_from_xhtml5edit_to_docbook: ...
                    schema:
         
                    # The following is common to template & docbook tags
                    config:
                        # This may use a container parameter (%some_parameter%) defined per instance
                        key: value
                    attributes:
                        attribute_name:
                            type: (string|boolean|integer|float|more ?)
                            required: (false|true)
                            default_value:
        

        With that config, it isn't possible to have the same tag defined as template & docbook. The semantic config will check that either template or xslt_* are set, since they are mutually exclusive.

        If that is acceptable, I will update the issue to reflect this approach.

        Show
        Bertrand Dunogier added a comment - - edited About the configuration suggested above, I have a suggestion that would clear out the risk of a tag being both template & docbook: ezrichtext: custom_tags: <name>: # If this is set, the tag is a template one template: 'path/to/template.html.twig'   # Inline is false by default inline: false   # If these are set, the tag is a docbook one xslt_from_docbook_to_xhtml5output: ... xslt_from_docbook_to_xhtml5edit: ... xslt_from_xhtml5edit_to_docbook: ... schema:   # The following is common to template & docbook tags config: # This may use a container parameter (%some_parameter%) defined per instance key: value attributes: attribute_name: type: (string|boolean|integer|float|more ?) required: (false|true) default_value: With that config, it isn't possible to have the same tag defined as template & docbook. The semantic config will check that either template or xslt_*  are set, since they are mutually exclusive. If that is acceptable, I will update the issue to reflect this approach.
        Hide
        André Rømcke added a comment -

        It's a good direction I think, what we might need to double check is:

        • if template is currently a valid use case also for docbook tags, but don't think so, things not using xslt like embed rather uses php which again uses view rendering and template afaik.
        • [Optional] template might be optional, as in we can have a fallback rendering of custom tags w/o xslt defined like we do for html5
          Alternative is throwing if template is not defined, unsure what gives best DX here.
        Show
        André Rømcke added a comment - It's a good direction I think, what we might need to double check is: if template is currently a valid use case also for docbook tags, but don't think so, things not using xslt like embed rather uses php which again uses view rendering and template afaik. [Optional] template might be optional, as in we can have a fallback rendering of custom tags w/o xslt defined like we do for html5 Alternative is throwing if template is not defined, unsure what gives best DX here.
        Hide
        Bertrand Dunogier added a comment -

        Implemented in EZP-28066.

        Show
        Bertrand Dunogier added a comment - Implemented in EZP-28066 .

          People

          • Assignee:
            Unassigned
            Reporter:
            André Rømcke
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: