How To Remove Insert Variable & Insert Widget From WYSIWYG Editor In Magento 2

How To Remove Insert Variable & Insert Widget From WYSIWYG Editor In Magento 2 by Meetanshi

WYSIWYG editor in Magento 2 is an HTML editor that offers “what you see is what you get”  functionality. It makes the task of adding, editing and formatting the content easier.

However, sometimes offering this editor gives unnecessary rights and features by allowing them to insert the variable and widget.

For example, the Magento marketplace has multiple users and vendors who can use the WYSIWYG editor from the admin panel. The super admin would not want them to use all the widgets but only allow designing with the editor. In such cases, one can use the below solution.

The default WYSIWYG editor in the Magento 2 is as shown here:

Default WYSIWYG Editor - Meetanshi

After implementing the below code, the WYSIWYG editor is as shown here:

Custom editor - Meetanshi

Method to remove add variable & add widget from WYSIWYG editor in Magento 2:

  1. Add below code in the system.xml file
  2. Create new file Editor.php at Vendor\Extension\Block\Adminhtml folder

That’s it.

Any doubts? Feel free to mention them in the Comments section below. I’ll help you out.

Please share the solution with the Magento community via social media.

Thank you.

 

5
(based on 1 Reviews)

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.

Leave a Reply

SUBSCRIBE
3.8
(based on 5 Reviews)