QuestionQ11

Store Operations and Admin

In a custom module, an Architect needs to define a new XML configuration file. The module must be able to read every XML configuration file declared in the system, merge them, and use their values in a PHP class.

Which two steps should the Architect take to meet this requirement?

Choose two
  • A Write a plugin for \Magento\Framework\Config\Data::get() and read the custom xml files
  • B Append the custom xml file name in “Magento\Config\Model\Config\Structure\Reader” in di.xml
  • C Create a Data class that implements “\Magento\Framework\Config\Data”
  • D Inject a “reader” dependency for “Magento\Framework\Config\Data” in di.xml
  • E Make a Reader class that implements “\Magento\Framework\Config\Reader\Filesystem”
Explanation

A custom configuration type uses a reader based on Magento\Framework\Config\Reader\Filesystem to collect and merge the module XML files. That reader must be supplied as the reader dependency of Magento\Framework\Config\Data in di.xml, which stores and makes the resulting configuration available to PHP. In actual PHP code, the reader class extends Filesystem; the option’s use of “implements” is imprecise.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!