I've made a new module and I would like to override the vendor/magento/module-config/view/adminhtml/templates/system/config/form/field/array.phtml

I've copied the file in app/code/myVendor/myModule/view/adminhtml/templates/system/config/form/field/array.phtml and I've added this xml file in app/code/myVendor/myModule/view/adminhtml/layout/config_form_field.xml:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock class="myVendor\myModule\Block\System\Form\Field\Multi" name="config_field">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">myVendor_myModule::system/config/form/field/array.phtml</argument>

But it doesn't take my new file, it still takes the file from vendor

1 Answer 1


Initially I was about to suggest that your module includes a sequence tag pointing to Magento_Config in the module xml which will tell Magento to load your module last, but then I saw something interesting - if your class extends vendor/magento/module-config/Block/System/Config/Form/Field/FieldArray/AbstractFieldArray.php then you will probably see that the abstract class has this:

 * @var string
protected $_template = 'Magento_Config::system/config/form/field/array.phtml';

so you will need to ovewrite this property and add your template file there in your custom block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.