Extension Folder Structure in Magento 2

A extension in Magento 2 is located in a single directory which simplifies the search and analysis of the extension’s logic. Now the standard module structure looks like this:

Let’s describe this structure. Once again all extensions are located in the app / code /. Then the following logic works:

  • Example: it is a vendor’s name (as a rule it coincides with the company name and should be unique). Extension – module (extension) name. The module includes the following:

  • Block: stores files that will ensure the interaction of the patterns (phtml from the View directory) with extension models or the whole system (optional directory).

  • Controller: these files are responsible for the connection of the module with the outside world – i.e. switching on the module by clicking on an url. (Example site.com/extension/index/index – lead to the module controller. (optional directory).

  • etc: contains the configuration files.

  • Helper: contains the files that are responsible for performing general tasks for extension objects and variables.

  • Model: contains the files that are responsible for connection with the database (optional directory).

  • Setup: includes the files that are necessary to make changes in the database – i.e. creating tables, fields, or other records required for the module performance (optional directory).

  • Test: contains the files that are necessary to perform the module test. (optional directory).

  • View: includes the files that are necessary for information output on the frontend and backend. Commonly these files contain html code (optional directory).

I Hope this will help you. and incase if this solution is not working for you and you find another solution for that then I’ll request you all the guy’s please share to all.

Review other articles maybe it'll help you too.




Recent Articles
Tags
Newsletter
Chrome Extension
Copyright © 2024 devhooks.in All rights reserved.
Ads OFF toggle_off
wifi_off