An Adobe Commerce developer is asked to change the tracking level on a custom module for free downloading of pdf and images.
The module contains following models:
Vendor\FreeDownload\Model\Download
Vendor\FreeDownload\Model\DownloadPdf extends Vendor\FreeDownload\Model\Download Vendor\FreeDownload\Model\DownloadImage extends Vendor\FreeDownload\Model\Download Download class has a parameter for tracking_level.
How will the developer configure the tracking_level parameter, in di.xml.to have a value of 4 for Download class and all classes that extend Download?
Answer(s): B
Explanation:
To configure the tracking_level parameter in di.xml to have a value of 4 for the Download class and all classes that extend Download, the developer would use the following code:
<config>
<global>
<models>
<Vendor\FreeDownload\Model\Download>
<setting name="tracking_level" value="4"/>
</Vendor\FreeDownload\Model\Download>
<Vendor\FreeDownload\Model\DownloadPdf>
<rewrite name="tracking_level" value="4"/>
</Vendor\FreeDownload\Model\DownloadPdf>
<Vendor\FreeDownload\Model\DownloadImage>
<rewrite name="tracking_level" value="4"/>
</Vendor\FreeDownload\Model\DownloadImage>
</models>
</global>
</config>
The setting element is used to set a configuration value for a specific model. The rewrite element is used to override the default configuration value for a specific model. In this case, the tracking_level parameter is set to 4 for all models that extend Download.
Reveal Solution Next Question