Magento 2 – How to Override base/ui_component/customer_form.xml

adminhtmlmagento2uicomponent

I want to override the below file

vendor/magento/module-customer/view/base/ui_component/customer_form.xml

I have copied that file to the specific location and made the changes.

app/code/[vendor]/[module]/view/base/ui_component/customer_form.xml

Also tried with below location

app/code/[vendor]/[module]/view/adminhtml/ui_component/customer_form.xml

But still, my changes do not reflect.

I just want to modify content in my ui_component file.

<field name="sendemail_store_id">
        <argument name="data" xsi:type="array">
            <item name="options" xsi:type="object">Magento\Store\Model\System\Store</item>
            <item name="config" xsi:type="array">
                <item name="label" xsi:type="string" translate="true">Send Welcome Email From</item>
                <item name="dataType" xsi:type="string">number</item>
                <item name="formElement" xsi:type="string">select</item>
            </item>
        </argument>
    </field>

Please help me if you have any idea.
I really appreciate your response.

Best Answer

Please refer this question, it is same as your question.

Override base/ui_component/customer_form.xml

In this overridden "lastname" field. So you can change it as per your requirement.

Try placing it in app/code/Vendor/Module/view/adminhtml/ui_component/customer_form.xml with the following content

<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<fieldset name="address">
    <field name="lastname">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="validation" xsi:type="array">
                    <!-- this should work but doesn't appear to, needed to do a core hack instead -->
                    <item name="required-entry" xsi:type="boolean">false</item>
                </item>
            </item>
        </argument>
    </field>
</fieldset>