Is this my Installdata.php file
<?php
namespace AutosmartCategoryAttributesSetup;
use MagentoCatalogModelCategory;
use MagentoCatalogModelCategoryAttributeBackendImage;
use MagentoCatalogModelCategoryAttributeSourceMode;
use MagentoCatalogModelResourceModelEavAttribute;
use MagentoEavModelEntityAttributeScopedAttributeInterface;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupInstallDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$this->addCustomCategoryAttributes($eavSetup);
}
private function addCustomCategoryAttributes(EavSetup $eavSetup)
{
$eavSetup->addAttribute(
Category::ENTITY,
'enable_disable',
[
'type' => 'int',
'label' => 'Enable/Disable',
'input' => 'select',
'source' => Mode::class,
'required' => false,
'sort_order' => 100,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'group' => 'General Information',
]
);
$eavSetup->addAttribute(
Category::ENTITY,
'custom_text',
[
'type' => 'text',
'label' => 'Custom Text',
'input' => 'textarea',
'required' => false,
'sort_order' => 101,
'global' => ScopedAttributeInterface::SCOPE_STORE,
'group' => 'General Information',
]
);
}
}
and this is category_form.xml file
<?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="general">
<field name="enable_disable" sortOrder="100" formElement="select">
<settings>
<dataType>boolean</dataType>
<label translate="true">Enable/Disable</label>
<dataScope>enable_disable</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
</settings>
<formElements>
<select>
<settings>
<options>
<option name="0" xsi:type="array">
<item name="value" xsi:type="string">0</item>
<item name="label" xsi:type="string">No</item>
</option>
<option name="1" xsi:type="array">
<item name="value" xsi:type="string">1</item>
<item name="label" xsi:type="string">Yes</item>
</option>
</options>
</settings>
</select>
</formElements>
</field>
<field name="custom_text" sortOrder="101" formElement="textarea">
<settings>
<dataType>text</dataType>
<label translate="true">Custom Text</label>
<dataScope>custom_text</dataScope>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
</settings>
<formElements>
<textarea>
<settings>
<!-- No initial value specified -->
</settings>
</textarea>
</formElements>
</field>
</fieldset>
</form>
My issue is entered any value in adminpanel it doesn’t saved after field shows empty