0

I have create custom category attribute as wysiwyg editor under content fieldset.

Attribute is showing and working fine but I want to add Hide/Show Editor button with atribute.

How can I do this?

I am using below code in adminhtml/ui_component/category_form.xml

   <fieldset name="content">
        <field name="category_information">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="class" xsi:type="string">Magento\Catalog\Ui\Component\Category\Form\Element\Wysiwyg</item>
                    <item name="formElement" xsi:type="string">wysiwyg</item>
                    <item name="wysiwygConfigData" xsi:type="array">
                        <item name="settings" xsi:type="array">
                            <item name="theme_advanced_buttons1" xsi:type="string">bold,italic,|,justifyleft,justifycenter,justifyright,|,fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code</item>
                            <item name="theme_advanced_buttons2" xsi:type="boolean">false</item>
                            <item name="theme_advanced_buttons3" xsi:type="boolean">false</item>
                            <item name="theme_advanced_buttons4" xsi:type="boolean">false</item>
                            <item name="theme_advanced_statusbar_location" xsi:type="boolean">false</item>
                        </item>
                        <item name="files_browser_window_url" xsi:type="boolean">false</item>
                        <item name="height" xsi:type="string">100px</item>
                        <item name="toggle_button" xsi:type="boolean">false</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">false</item>
                    </item>
                    <item name="template" xsi:type="string">ui/form/field</item>
                    <item name="source" xsi:type="string">category</item>
                    <item name="wysiwyg" xsi:type="boolean">true</item>
                    <item name="dataScope" xsi:type="string">category_information</item>
                    <item name="sortOrder" xsi:type="number">110</item>
                    <item name="rows" xsi:type="number">8</item>
                    <item name="label" xsi:type="string" translate="true">Category Information</item>
                    <item name="notice" xsi:type="string" translate="true"></item>
                    <item name="additionalClasses" xsi:type="string">category-desc</item>

                </item>
            </argument>
        </field>

    </fieldset>
  • Let me know if my solution helps you. Thanks – Kishan Savaliya Nov 6 at 6:43
1

You need to change this line in your ui_component file

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

with this

<item name="toggle_button" xsi:type="boolean">true</item>

After changing this value from false to true please run below commands.

php bin/magento cache:clean && php bin/magento cache:flush

Hope this will help you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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