I have a custom extension which adds new inputs to Magento's configuration. Some of the inputs are arrayFields and its defined in system.xml file as:

<field id="custom_ranking_product_attributes" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
        <![CDATA[ Some comment ]]>

Class My\CustomModule\Model\Source\CustomRankingProduct is a child of Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray.

In config.xml file I have defined a default value for this input like:


In Magento 2.0.* I can see the default value filled to the input: With default value

But in Magento 2.1.* it's empty: No default value

However, when I try to get the config value, the correct array is returned in both 2.0.* and 2.1.. Just 2.1. doesn't display the default value so after the initial configuration save it becomes empty.

What can I do to have the default value correctly displayed even in Magento 2.1?

  • how to set validation for above fields in system.xml
    – Jaisa
    Feb 13, 2018 at 7:06

1 Answer 1


Write default value to database in data install script.

  • I wanted to avoid that solution, but I didn't manage to find any other solution. Thanks! ;)
    – Jan Petr
    Aug 11, 2017 at 19:17

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.