Let’s initiate a discussion!!
If you are trying to print WYSIWYG editor content into the reading format in the code condition when content is added from the WYSIWYG editor from the admin panel, and content displays something weird, then you can solve the issue by following below steps.
Step 1: Create Registration
Create registration.php file in the app/code/Magemonkeys/Wysiwygdata folder with the following code.
1 2 3 4 5 6 |
<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Magemonkeys_Wysiwygdata', __DIR__ ); |
Step 2: Create a module
Create a module.xml file in the app/code/Magemonkeys/Wysiwygdata/etc folder with the following code.
1 2 3 4 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magemonkeys_Wysiwygdata" setup_version="1.0.0"></module> </config> |
Step 3: Create a Helper
Create a Data.php file in the app/code/Magemonkeys/Wysiwygdata/Helper with the following code.
Add a dependency Zend_Filter_Interface to your block
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<?php namespace Magemonkeys\Wysiwygdata\Helper; use Magento\Framework\App\Helper\AbstractHelper; class Data extends AbstractHelper { protected $templateProcessor; public function __construct( Context $context, \Zend_Filter_Interface $templateProcessor ) { $this->templateProcessor = $templateProcessor; parent::__construct($context); } public function getWysiwygContent($content) { try{ return $this->templateProcessor($content); }catch (\Exception $e){ return false; } } } |
Now when you need to retrive data, you will just need to load helper and use getWysiwygContent() function by passing content
For Example,
Load helper “Magemonkeys\Wysiwygdata\Helper\Data” using $_helper object
after loading helper you can access
$_helper->getWysiwygContent($content);
[crayon-642179be9fb78133001930/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.