Magento 2 how to display editor data in phtml ?

Magento 2 how to display editor data in phtml ?

1.) Declare object in etlc/di.xml

Magento\Widget\Model\Template\Filter

2.) In Display.php

protected $templateProcessor;

public function __construct(

\Magento\Framework\View\Element\Template\Context $context,

\Zend_Filter_Interface $templateProcessor,

array $data = []

) {

parent::__construct($context, $data);

$this->templateProcessor = $templateProcessor;

}

public function filterOutputHtml($string)

{

return $this->templateProcessor->filter($string);

}

3.) In phtml file

$string = your editor data;

Echo $block->filterOutputHtml($string);

?>



Copyright © 2024 Tridhya Tech Limited, Inc. All rights reserved.