Details
-
Bug
-
Resolution: Fixed
-
High
-
5.4.6
-
None
Description
After update kernel from 5.4.5 to 5.4.6 the ezxmltext value (paragraph>custom>section) is not parsed correctly (missing ez-temporary="1" attribute).
<?xml version="1.0" encoding="utf-8"?> <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"> <custom name="respondiv" custom:xs="12" custom:sm="12" custom:md="6" custom:lg="6" custom:class="text-center"> <section> <header> <link url="http://test/"> <embed view="embed" size="original" object_id="29673" /> </link> </header> </section> </custom> </paragraph>
should be parsed as:
<?xml version="1.0" encoding="utf-8"?> <paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" ez-temporary="1"> <custom name="respondiv" custom:xs="12" custom:sm="12" custom:md="6" custom:lg="6" custom:class="text-center"> <section> ...
Possible solution is to extend https://github.com/ezsystems/ezpublish-kernel-ee/blob/5.4/eZ/Publish/Core/FieldType/XmlText/Converter/Expanding.php#L165
with additional check:
|| $xpath->query('custom/section', $paragraph)->length !== 0
before the update the condition was less strict:
https://github.com/ezsystems/ezpublish-kernel-ee/commit/2e2ec33e562c1894e4e87c79f249a6cf60ef6dba#diff-d559666efad4f1b0c9e7925413fff041L56
EDITED
Steps to reproduce:
1. Create a new file - ezpublish/resources/xsl/factbox.xsl - with the following content:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 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"> <xsl:output method="html" indent="yes" encoding="UTF-8"/> <xsl:param name="factbox" select="'factbox '"/> <xsl:template match="custom[@name='factbox']"> <xsl:element name="div"> <xsl:attribute name="class"> <xsl:value-of select="$factbox"/> <xsl:value-of select="@custom:align"/> </xsl:attribute> <div class="box-content"> <h5><xsl:value-of select="@custom:title"/></h5> <xsl:apply-templates/> </div> </xsl:element> </xsl:template> </xsl:stylesheet>
2. Edit ezpublish.yml:
ezpublish: system: default: fieldtypes: ezxml: custom_tags: - path: "%kernel.root_dir%/resources/xsl/factbox.xsl" priority: 10
3. On the admin interface, create a new article;
4. In the "body" field, click the "Insert custom tag" button, select "factbox" from the list, and click OK;
5. Select text "factbox" in created custom tag, change format from "paragraph" to "Heading 1", click at the end of the text line in factbox, and press enter;
6. In the created line place text "paragraph", and press enter at the end of the line;
7. In the third line click "Insert custom tag", select "factbox" from list, change title to "factbox2", and click OK;
8. Change the "factbox" text in second factbox to "factbox test";
9. Disable the editor, it should look like this:
<custom name="factbox" custom:title="factbox" custom:align="right"> <header level="1">factbox</header> paragraph <custom name="factbox" custom:title="factbox2" custom:align="right">factbox test</custom> </custom>
10. Click "send for publishing";
11. Go to the frontend, access the article, and view the page source.
In 5.4.6 (ezpublish-kernel) the result will be:
<div class="ezxmltext-field"> <p> <div class="factbox right"> <div class="box-content"> <h5>factbox</h5> <a name="eztoc_1_1" id="eztoc_1_1"></a> <h2>factbox</h2> <p>paragraph</p> <div class="factbox right"> <div class="box-content"> <h5>factbox2</h5> <p>factbox test</p> </div> </div> </div> </div> </p> </div>
on 5.4.5 it was:
<div class="ezxmltext-field"> <div class="factbox right"> <div class="box-content"> <h5>factbox</h5> <a name="eztoc_1_1" id="eztoc_1_1"></a> <h2>factbox</h2> <p>paragraph</p> <div class="factbox right"> <div class="box-content"> <h5>factbox2</h5> <p>factbox test</p> </div> </div> </div> </div> </div>
Attachments
Issue Links
- relates to
-
EZP-24710 Paragraphs are stripped on the front-end if an XML block is published with the editor disabled
- Closed