Custom Config Files in Magento2

So you want to include a custom config file in your M2 module?

So for anyone else that is going down the road of creating a custom config section, you pretty much HAVE to implement your own instance of ConverterInterface (eg, Magento\Framework\Config\Converter\Dom) otherwise the data array that is built for this XML:

Ends up looking like this:

This post on Vinai Kopp’s blog helped me build mine. Below is a modified (simplified) version of the one I built.

With this converter in place, the XML now looks like this PHP Array:

And can be referenced via $config->get('mycustomroot/mycustomchild/mychild1')

Comments !

blogroll

social