0

I just wanted to disable pagebuilder from category description without using ui_component category_form.xml , is there any other way to do that like using plugin/event ?

2 Answers 2

1

Try this way

For that, you have to first override view/adminhtml/ui_component/category_form.xml in your custom module.

Inside your category_form.xml you have to add your code.

<?xml version="1.0" ?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="content">
        <field name="description" template="ui/form/field" sortOrder="50" formElement="wysiwyg">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="wysiwygConfigData" xsi:type="array">
                        <item name="height" xsi:type="string">100px</item>
                        <item name="add_variables" xsi:type="boolean">false</item>
                        <item name="add_widgets" xsi:type="boolean">false</item>
                        <item name="add_images" xsi:type="boolean">true</item>
                        <item name="add_directives" xsi:type="boolean">true</item>
                        <item name="is_pagebuilder_enabled" xsi:type="boolean">false</item>
                    </item>
                    <item name="source" xsi:type="string">category</item>
                </item>
            </argument>
            <settings>
                <label translate="true">Description</label>
                <notice translate="true">Note: Keyboard shortcut to activate editor help : Alt + 0 (Windows) or &#x2325;0 (MacOS)</notice>
                <dataScope>description</dataScope>
            </settings>
            <formElements>
                <wysiwyg class="Magento\Catalog\Ui\Component\Category\Form\Element\Wysiwyg">
                    <settings>
                        <rows>8</rows>
                        <wysiwyg>true</wysiwyg>
                    </settings>
                </wysiwyg>
            </formElements>
        </field>
    </fieldset>
</form>

Add the below code for the description field inside wysiwygConfigData

<item name="is_pagebuilder_enabled" xsi:type="boolean">false</item>
0

To disable Page Builder for the category description in Magento 2 without modifying the category_form.xml file, you can create a custom module and use a plugin. First, create the custom module and configure its module.xml file.

Then, create a plugin that targets the Magento\PageBuilder\Model\Config\CategoryConfig class. In the plugin, intercept the getPageBuilderStatus() method and modify it to return false.

This change will effectively disable Page Builder for the category description. Finally, enable the custom module, clear the cache, and test the functionality to ensure that Page Builder is disabled for the category description as desired.

Here is the sample code(plugin),

CategoryConfigPlugin.php

<?php
namespace YourNamespace\YourModule\Plugin;

class CategoryConfigPlugin
{
    public function afterGetPageBuilderStatus(\Magento\PageBuilder\Model\Config\CategoryConfig $subject, $result)
    {
        return false;
    }
}
5
  • As I have tested this class is not exists can you please recheck ?
    – Mark
    May 29, 2023 at 11:46
  • This class Magento\PageBuilder\Model\Config\CategoryConfig is not exists in magento 2.4.5-p1 please check
    – Mark
    May 29, 2023 at 11:53
  • Magento\Catalog\Block\Adminhtml\Category\Edit\Form check this class
    – Harun
    May 29, 2023 at 12:00
  • This class is also not exists can you please check
    – Mark
    May 29, 2023 at 12:03
  • Can you please provide proper class ?
    – Mark
    May 29, 2023 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.