How to add WYSIWYG Editor in Magento system configuration?

How to add WYSIWYG Editor in Magento system configuration?

August 7, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add WYSIWYG Editor in Magento system configuration?

Enhancing Magento Admin Experience: Adding a WYSIWYG Editor to System Configuration

As an experienced developer working with e-commerce platforms like Magento, you often find yourself looking for ways to streamline the admin interface for better efficiency and user experience. One such enhancement is integrating a WYSIWYG (What You See Is What You Get) editor into system configuration pages.

In this guide, we’ll walk through the process of adding a WYSIWYG editor to your Magento 2 backend system configuration and retrieving the input values for dynamic content creation. This tutorial assumes you have a good understanding of Magento development and coding.

Why Use a WYSIWYG Editor in System Configuration?

Adding a WYSIWYG editor to your Magento admin interface offers several benefits:

  1. Improved User Experience: Non-technical users can easily create formatted content without needing HTML knowledge.
  2. Consistent Styling: Ensures that all configured content maintains the desired layout and style.
  3. Time Savings: Reduces manual editing and formatting efforts.

Step-by-Step: Integrating a WYSIWYG Editor

1. Enable the TinyMCE Library

First, you need to enable the TinyMCE library in your Magento installation. This is usually pre-installed, but ensure it’s active:

php bin/magento module:enable Magento_Widget

Then, compile the library:

php bin/magento setup:di:compile

2. Create a New System Configuration Field

Navigate to app/code/Magento/Config/etc/adminhtml/system.xml and add your WYSIWYG field under the desired section:

<system>
    <tab id="general" translate="label">
        <label>General</label>
    </tab>
    <section id="your_section_id" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
        <label>Your Section Title</label>
        <group id="your_group_id">
            <field id="wyg_field_id" translate="label" type="editor" sortOrder="5" showInDefault="1"
                  showInWebsite="1" showInStore="0">
                <label>WYSIWYG Field</label>
                <backend_model>Magento\Widget\Backend\Widget\Options</backend_model>
                <source_model>Magento\Widget\Model\Widget\Source</source_model>
                <config>default/design/theme_config/wyg_field_id</config>
            </field>
        </group>
    </section>
</system>

3. Retrieve the WYSIWYG Content

To fetch the configured content, you can use the following code snippet in your module’s controller:

$wygFieldValue = $this->getRequest()->getPost('groups')[Your_Group_Id]['fields'][Wyg_Field_ID]['value'];

Replace Your_Group_Id and Wyg_Field_ID with the respective IDs from step 2.

Conclusion

Adding a WYSIWYG editor to your Magento system configuration significantly enhances the admin experience, making it easier for users to create formatted content without requiring HTML knowledge. By following this guide, you can seamlessly integrate TinyMCE into your existing backend and fetch the configured data using standard Magento request handling.

Remember to test thoroughly after each step and ensure that your custom code aligns with Magento best practices.

For more advanced customizations and system configuration management, consider exploring the Laravel Company blog for in-depth tutorials on Magento development.

Magento 2 Extensions Themes Admin

Our network