aneesahmadweb@gmail.com     03040836207

    Create file Install Anees/Work/Setup/InstallSchema.php

    <?php
    
    namespace AneesWorkSetup;
    
    use MagentoEavSetupEavSetup;
    
    use MagentoEavSetupEavSetupFactory;
    
    use MagentoFrameworkSetupInstallDataInterface;
    
    use MagentoFrameworkSetupModuleContextInterface;
    
    use MagentoFrameworkSetupModuleDataSetupInterface;
    
    /**
    
    * @codeCoverageIgnore
    
    */
    
    class InstallData implements InstallDataInterface
    
    {
    
       /**
    
        * EAV setup factory
    
        *
    
        * @var EavSetupFactory
    
        */
    
       private $eavSetupFactory;
    
       /**
    
        * Init
    
        *
    
        * @param EavSetupFactory $eavSetupFactory
    
        */
    
       public function __construct(EavSetupFactory $eavSetupFactory)
    
       {
    
           $this->eavSetupFactory = $eavSetupFactory;
    
       }
    
       /**
    
        * {@inheritdoc}
    
        * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
    
        */
    
       public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
    
       {
    
           /** @var EavSetup $eavSetup */
    
           $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
    
           /**
    
            * Add attributes to the eav/attribute
    
            */
    
           $eavSetup->addAttribute(
    
               MagentoCatalogModelCategory::ENTITY,
    
               'category_custom_editor',
    
               [
    
                   'group' => 'General Information',
    
                   'type' => 'text',
    
                   'label' => 'Category Bottom content',
    
                   'input' => 'textarea',
    
                   'global' => MagentoCatalogModelResourceModelEavAttribute::SCOPE_STORE,
    
                   'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
    
                   'sort_order' => 11,
    
                   'visible' => true,
    
                   'required' => false,
    
                   'user_defined' => true,
    
                   'default' => '',
    
               ]
    
           );
    
       }
    
    }
    
    
    

    So in above example you will see the attribute name category_custom_editor  

    Which will create in table eav_attribute as this is the table which contains our all attributes.

    Now create a file view/adminhtml/ui_component/category_form.xml

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <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="category_custom_editor" template="ui/form/field" sortOrder="10" formElement="wysiwyg">
    
               <argument name="data" xsi:type="array">
    
                   <item name="config" xsi:type="array">
    
                       <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="height" xsi:type="string">10px</item>
    
                           <item name="toggle_button" xsi:type="boolean">false</item>
    
                           <item name="add_variables" xsi:type="boolean">true</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>
    
                       <item name="source" xsi:type="string">category</item>
    
                   </item>
    
               </argument>
    
               <settings>
    
                   <scopeLabel>[STORE VIEW]</scopeLabel>
    
                   <label translate="true">Category Below Content</label>
    
                   <dataScope>category_custom_editor</dataScope>
    
               </settings>
    
               <formElements>
    
                   <wysiwyg class="MagentoCatalogUiComponentCategoryFormElementWysiwyg">
    
                       <settings>
    
                           <rows>4</rows>
    
                           <wysiwyg>true</wysiwyg>
    
                       </settings>
    
                   </wysiwyg>
    
               </formElements>
    
           </field>
    
       </fieldset>
    
    </form>

    After this run setup upgrade and flush cache.Your changes will be visible in category page.

    About Author

    You may also like

    No Comment

    You can post first response comment.

    Leave A Comment

    Please enter your name. Please enter an valid email address. Please enter a message.