Created
October 15, 2013 18:29
-
-
Save lolautruche/6996323 to your computer and use it in GitHub Desktop.
Convert XmlText to HTML - eZ Publish 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set html = content.getFieldValue( "my_xmltext_field" ).xml|xmltext_to_html5 %} | |
<div> | |
{{ html }} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Assuming you're in a controller | |
$xmlTextValue = $myContent->getFieldValue( 'my_xmltext_field' ); | |
/** @var \eZ\Publish\Core\FieldType\XmlText\Converter\Html5 $html5Converter */ | |
$html5Converter = $this->get( 'ezpublish.fieldType.ezxmltext.converter.html5' ); | |
$html = $html5Converter->convert( $xmlTextValue->xml ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment