Monday, July 4, 2022
HomeMagentoIdentify which module-controller corresponds to a given URL in Magento 2

Identify which module-controller corresponds to a given URL in Magento 2

In this article, you going to see to identify module or controller for the given URL in Magento 2. we going to check this step by step.

Let’s start with an identity which module/controller in Magento 2 step by step

magento url
magento url

In above the image you see the URL, frontend section and controller part.

From front-end section of the URL you can identify the module.

This frontend section is declared in route xml file and front name.

It is declared in etc folder of module.

Below is sample of route xml you can come to understand completely in identifying of module.

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <!--Use router 'standard' for frontend route-->
    <router id="standard">
        <!--Define a custom route with id and frontName-->
        <route frontName="tutorial" id="tutorial">
            <!--The module which this route match to-->
            <module name="Techone_HelloWorld"/>
        </route>
    </router>
</config>

If it’s not too much trouble investigate the code, you will see it’s exceptionally easy to enroll a course.

You should utilize the standard switch for the frontend.

This course will have a youngster which characterize the module for it and 2 traits:

  • The id attribute is a special string that will recognize this course. You will utilize this string to pronounce the design handle for the activity of this module
  • The font name quality is additionally a one of a kind string which will be appeared on the URL demand. For instance, in the event that you proclaim a course this way:
<route frontName="tutorial" id="tutorial">

As you see in above route xml , frontend name tutorial.

Below declaration of the front name section you see the module name section.

So finally you come to know how to identify module from frontend section using URL.

Identify in Controller corresponds to a given URL

As you see in the above url in there is frontend section.

After the frontend section there is controller part section in URL.

So this way you can identify the controller and module in URL.

Magento2 form validation not working

I hope you liked my this article. If you have any queries or any question regarding this, Feel free to comment on Me.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular