Skip to content

crudEAV cannot handle "Use Default Value"  #29

@ioweb-gr

Description

@ioweb-gr

I've created an EAV entity with this template, and added a custom attribute with store view scope.

e.g.

        $attributes = [];
        $attributes['name'] = [
            'type' => 'varchar',
            'label' => 'Name',
            'input' => 'text',
            'required' => true, //true/false
            'sort_order' => 10,
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'group' => 'General',
        ];

        foreach($attributes as $attributeCode => $attributeData){
            $this->eavSetup->addAttribute(CookieSetup::ENTITY_TYPE_CODE, $attributeCode, $attributeData);
        }

My problem here is when trying to save the object in the backend for a different store view other than default, I'm unable to reset the value to use default.

image

I've tried modifying the ui form component to add the "Use Default Value" checkbox to test, but it's totally ignored

e.g.

        <field name="name" formElement="input" sortOrder="20" >
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="service" xsi:type="array">
                        <item name="template" xsi:type="string">ui/form/element/helper/service</item>
                    </item>
                </item>
            </argument>
            <settings>
                <visible>true</visible>
                <dataType>text</dataType>
                <label translate="true">Name</label>
                <validation>
                    <rule name="required-entry" xsi:type="boolean">true</rule>
                </validation>
            </settings>
        </field>

image

And after saving the value still remains. It's never deleted for the current store view.

I'm assuming something is missing from the resourceModel to handle the "Use Default Value"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions