I want to create the category attribute with pagebuilder button. I have tried with below code but its not working. After save the category it is showing wysiwyg editor instead of pagebuilder button.
i have used magento version is 2.4.5-p1 which is upgaded from 2.3. Same code working on fresh magento version 2.4.5-p1.
here is a installData.php
/**
* {@inheritdoc}
*/
public function install(
ModuleDataSetupInterface $setup,
ModuleContextInterface $context
) {
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
MagentoCatalogModelCategory::ENTITY,
'pagebuildertopcontent',
[
'type' => 'text',
'label' => 'Top Content',
'input' => 'textarea',
'sort_order' => 110,
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => '',
'group' => 'PageBuilder Content Settings',
'backend' => ''
]
);
}
Here is a category_form.xml files
<field name="pagebuildertopcontent" 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="is_pagebuilder_enabled" xsi:type="boolean">true</item>
<item name="pagebuilder_button" xsi:type="boolean">true</item>
<item name="toggle_button" xsi:type="boolean">true</item>
<item name="height" xsi:type="string">100px</item>
</item>
<item name="source" xsi:type="string">category</item>
</item>
</argument>
<settings>
<label translate="true">dev</label>
<notice translate="true">Note: Keyboard shortcut to activate editor help : Alt + 0 (Windows) or ⌥0 (MacOS)</notice>
<dataScope>pagebuildertopcontent</dataScope>
</settings>
<formElements>
<wysiwyg class="MagentoCatalogUiComponentCategoryFormElementWysiwyg">
<settings>
<rows>8</rows>
<wysiwyg>true</wysiwyg>
</settings>
</wysiwyg>
</formElements>
</field>