Details
-
Bug
-
Resolution: Fixed
-
High
-
2.4.1
-
None
-
[3.0] - Sprint 1
Description
Note:
The issue is reproducible only in dev mode.
Steps to reproduce:
- Configure custom tag (see below)
- Create content, insert a custom tag in the RichText field
- In the custom tag insert:
- First paragraph with text
- Second paragraph with URL
- Third paragraph with URL
- 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:
- In ezplatform.yml add:
ezpublish: system: default: fieldtypes: ezrichtext: custom_tags: [bulbo]
- 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: ''
- In your AppBundle, create the following custom tag template (in AppBundle/Resources/views/custom_tags):
<div class="bulbo"> {{ content|raw }} </div>
- 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.