nerdexam
Adobe

AD0-E716 · Question #36

An Adobe Commerce developer is tasked to add a file field to a custom form in the administration panel, the field must accept only .PDF files with size less or equal than 2 MB. So far the developer…

The correct answer is B. Option B. The developer can add a virtual type for Myvendor\MyModuie\Modei\customPdfupioader specifying the aiiowedExtensions and the maxFiiesize for the constructor, within the module's di.xmi. This way, the developer can reuse the existing file uploader class and customize it for the…

Customization

Question

An Adobe Commerce developer is tasked to add a file field to a custom form in the administration panel, the field must accept only .PDF files with size less or equal than 2 MB. So far the developer has added the following code within the form component xml file, inside the fieldset node:

How would the developer implement the validations? A) Add the Validations Within the HyVendor\MyModule\Controller\Adminhtml\CustomEntity\UploadPdf Controller B) Add a virtual type forMyvendor\MyModuie\Modei\customPdfupioader specifying the aiiowedExtensions and the maxFiiesize for the constructor, within the module's di.xmi:

C) Add the following code inside the<settings> node:

Exhibit

AD0-E716 question #36 exhibit

Options

  • AOption A
  • BOption B
  • COption C

How the community answered

(28 responses)
  • A
    7% (2)
  • B
    71% (20)
  • C
    21% (6)

Explanation

The developer can add a virtual type for Myvendor\MyModuie\Modei\customPdfupioader specifying the aiiowedExtensions and the maxFiiesize for the constructor, within the module's di.xmi. This way, the developer can reuse the existing file uploader class and customize it for the specific field without modifying the core code. Verified Reference: [Magento 2.4 DevDocs] [Magento Stack

Topics

#file upload#virtual types#file validation#admin forms

Community Discussion

No community discussion yet for this question.

Full AD0-E716 Practice