22

Convert RichText to HTML in PHP API

 3 years ago
source link: https://www.symfony.fi/ez-platform-tip/convert-richtext-to-html-in-php-api
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Convert RichText to HTML in PHP API

eZ Platform stores Rich Text internally in XML. To convert this XML to HTML markup common in web projects, you can use this API:

$xhtml5Converter = $this->container->get('ezpublish.fieldType.ezrichtext.converter.output.xhtml5');
$xml = $view->getContent()->getFieldValue('content')->xml;
$html = $xhtml5Converter->convert($xml)->saveHTML();
echo $html;

Written by Jani Tarvainen on Monday January 21, 2019
Permalink -

« Update or create multiple languages at once using eZ Platform PHP API - Load Location / Content by URL Alias in eZ Platform »


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK