Passos para reproduzir
1. O script Module UpgradeData.php contém:
$categorySetup->addAttribute(Category::ENTITY, 'roflcopter', [
'type' => 'int',
'label' => 'CMS Block',
'input' => 'select',
'source' => 'Magento\Catalog\Model\Category\Attribute\Source\Page',
'required' => false,
'sort_order' => 20,
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
'group' => 'Display Settings',
]);
2. visualize / 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="Navigation">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="label" xsi:type="string" translate="true">Navigation</item>
<item name="collapsible" xsi:type="boolean">true</item>
<item name="sortOrder" xsi:type="number">100</item>
</item>
</argument>
<field name="roflcopter">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="sortOrder" xsi:type="number">60</item>
<item name="dataType" xsi:type="string">string</item>
<item name="formElement" xsi:type="string">select</item>
<item name="label" xsi:type="string" translate="true">Roflcopter</item>
</item>
</argument>
</field>
</fieldset>
</form>
Resultado esperado
- No formulário de categoria deve aparecer no menu suspenso, selecione Roflcopter with CMS Blocks como opções
Resultado atual
- Menu suspenso vazio
gielberkers.com/adding-custom-category-attributes-magento-2-1/…
—
Praful Rajput