AD0-E717 practice question 11 of 15

Which file should a developer use to set the default value when creating configuration fields for admin?

Full set: 77 questions
Answer options
A: etc/adminhtml/config.xml
B: etc/config xml Correct answer
C: etc/adminhtml/system.xml
Correct Answer:
B. etc/config xml
Explanation

The etc/config.xml file is the standard location within a module to define the default values for system configuration fields. When a module is installed or upgraded via the setup:upgrade command, Adobe Commerce reads this file and populates the coreconfigdata database table with these values for the 'default' configuration scope. This ensures that the module has its necessary default settings established system-wide without manual intervention in the Admin panel.

Why Incorrect

A. etc/adminhtml/config.xml: This is an incorrect file path. While configuration files exist in the etc/adminhtml directory, the specific file for setting default values for system configuration, config.xml, resides in the module's root etc directory.
C. etc/adminhtml/system.xml: This file is used to define the structure, layout, and user interface of the configuration fields that appear in the Admin panel under Stores > Settings > Configuration. It does not set the default values for these fields. ---

References

1. Adobe Commerce Developer Documentation, "Create a config.xml file": This official guide explicitly states, "A module’s config.xml file contains the default values for all fields that you defined in the system.xml file." It specifies the file path as /etc/config.xml.

Source: Adobe Commerce Developer Documentation > Development > Admin > Configuration > Create a config.xml file.

2. Adobe Commerce Developer Documentation, "Create a system.xml file": This document details the purpose of system.xml, confirming it is for defining the configuration sections, groups, and fields that are rendered in the Admin UI. It specifies the path as /etc/adminhtml/system.xml.

Source: Adobe Commerce Developer Documentation > Development > Admin > Configuration > Create a system.xml file.

Scroll to Top