system.xml saved config validation in Magento 2

- Fire development, Magento 2

Magento 2 Development

system.xml saved config validation in Magento 2 is possible via attaching a backend model to the field and validating the value server side.

Check Magento_Backend/etc/adminhtml/system.xml for the example:

There is the backend model in this field:

Consequently the method Magento\Config\Model\Config\Backend\Baseurl::beforeSave is called when saving the field.

Source: stackexchange question, Marius

More tips from the cookbook