Details
-
Bug
-
Resolution: Fixed
-
High
-
5.4.12
-
None
Description
The customer observed issue with Custom Tags: after rendering them via twig unwanted paragraph tag is visible.
Steps to reproduce:
1. Create a clean installation of eZ Publish.
2. Add a new custom tag using example configuration:
ezpublish.yml
system: eng: fieldtypes: ezxml: custom_tags: - { path: %kernel.root_dir%/../src/AppBundle/Resources/views/tags/facebook.xsl } location_view: full: test: template: AppBundle::test.html.twig match: Identifier\ContentType: [folder]
content.init
[CustomTagSettings] AvailableCustomTags[] AvailableCustomTags[]=facebook
3. Use an example XSL template for custom tag.
facebook.xsl
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/" xmlns:image="http://ez.no/namespaces/ezpublish3/image/" exclude-result-prefixes="xhtml custom image php"> <xsl:output method="html" indent="yes" encoding="UTF-8"/> <xsl:template match="custom[@name='facebook']"> <two-click> <xsl:attribute name="data-component"> <xsl:text>two-click</xsl:text> </xsl:attribute> <xsl:attribute name="data-id"> <xsl:value-of select="@custom:src"/> </xsl:attribute> <xsl:attribute name="data-type"> <xsl:text>facebook</xsl:text> </xsl:attribute> <xsl:attribute name="class"> <xsl:text>custom-tag-facebook</xsl:text> </xsl:attribute> <h4> Active Facebook Content </h4> <span> Here is some Text... </span> <button>Click me</button> </two-click> </xsl:template> </xsl:stylesheet>
4. Create e.g. folder and add facebook custom tag in "Description" field.
5. Render folder's description in twig using following template:
test.html.twig
{% block content %}
{{ ez_field_value(content, 'description').xml | xmltext_to_html5 }}
{% endblock %}
Result:
Custom tag is wrapped with unwanted <p> tag, see output below:
<p><two-click data-component="two-click" data-id="" data-type="facebook" class="custom-tag-facebook"> <h4> Active Facebook Content </h4> <span> Here is some Text... </span> <button>Click me</button> </two-click></p>
Attachments
Issue Links
- relates to
-
EZP-29331 Custom Tags added in Legacy Bridge gets rendered inside paragraph in the new stack
- Closed