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

RichText Link converter emits warning during custom tag conversion

    Details

    • Sprint:
      [3.0] - Sprint 1

      Description

      Note:
      The issue is reproducible only in dev mode.

      Steps to reproduce:

      1. Configure custom tag (see below)
      2. Create content, insert a custom tag in the RichText field
      3. In the custom tag insert:
        1. First paragraph with text
        2. Second paragraph with URL
        3. Third paragraph with URL
      4. Publish

      Result:
      You should see an Symfony's exception page (see attachment) with message:

      An exception has been thrown during the rendering of a template ("Warning: DOMXPath::query(): Undefined namespace prefix") in "@admin/fieldtypes/preview/content_fields.html.twig".
      

      Expected result:
      Custom tag should be rendered normally.

      Configure custom tag:

      1. In ezplatform.yml add:

        ezpublish:
            system:
                default:
                    fieldtypes:
                        ezrichtext:
                            custom_tags: [bulbo]
        

      2. Moreover, in ezplatform.yml or config.yml add:

        ezrichtext:
            custom_tags:
                bulbo:
                    template: 'AppBundle:custom_tags:bulbo.html.twig'
                    attributes:
                        title:
                            type: 'string'
                            required: false
                            default_value: ''
        

      3. In your AppBundle, create the following custom tag template (in AppBundle/Resources/views/custom_tags):

        <div class="bulbo">
            {{ content|raw }}
        </div>
        

      4. Clear the cache.

      More information:
      The XML is converted first by EzSystems\EzPlatformRichText\eZ\RichText\Converter\Link then, the next converter is EzSystems\EzPlatformRichText\eZ\RichText\Converter\Render\Template which does getCustomTemplateContent -> that “extracts” `<para>` from section and calls EzSystems\EzPlatformRichText\eZ\RichText\Converter\Aggregate::convert again. Therefore, Link converter is used again, but this time without <section> in XML, just only separated, multiple <para>. Each of them has own namespace declaration(s) and for the first (without link) xmlns:xlink is missing.

        Activity

        Hide
        Michał Szołtysek added a comment -

        QA Approved on eZ Platform EE v2.4.2 with diff.

        Show
        Michał Szołtysek added a comment - QA Approved on eZ Platform EE v2.4.2 with diff.

          People

          • Assignee:
            Unassigned
            Reporter:
            Kamil Madejski
          • Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Agile