Magento – Add Wysiwyg attribute to category in Magento 2.2.4

category-attributemagento2.2.4wysiwyg

I followed this reference Inchoo to add new Wysiwyg attribute to category in Magento 2.2.4. It's working fine. My custom attribute successfully added in the category but it's showing only textarea instead of Wysiwyg editor.

Help would be appreciated!

Best Answer

After digging into magento attribute table structure I found that Magento has changed wysiwyg_enabled field to is_wysiwyg_enabled from catalog_eav_attribute table.

So we need to change wysiwyg_enabled to is_wysiwyg_enabled from setup script

$eavSetup->addAttribute(
    \Magento\Catalog\Model\Category::ENTITY,
    'menu_content',
    [
        'type' => 'text',
        'label' => 'Menu Content',
        'input' => 'textarea',
        'required' => false,
        'sort_order' => 4,
        'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
        'is_wysiwyg_enabled' => true,
        'is_html_allowed_on_front' => true,
        'group' => 'General Information',
    ]
);