How to create controller without creating menu in Adminhtml Magento 2Magento 2 Custom Admin Action Redirected to DashboardIs it necessary to override _isAllowed in your Admin controller?Magento Adminhtml Controller looking for the wrong URLHow to create menu and it's controller in magento 2Magento 2: How to add a link to Stores->ConfigurationPublic actions in admin controllersOverride Magento Adminhtml ControllerMagento 2 custom Admin controller redirect to DashboardForm is not displayed on panel admin Magento 22 Different keys are being genereated, Admin Grid action column-> edit link and page created after clicking save and continue butottonMagento 2 Can't submit custom form with custom controller-action in admin order detail page

Could a Weapon of Mass Destruction, targeting only humans, be developed?

Is there a legal way for US presidents to extend their terms beyond four years?

Is it okay to fade a human face just to create some space to place important content over it?

Is it bad to describe a character long after their introduction?

Can Aziraphale and Crowley actually become native?

Just graduated with a master’s degree, but I internalised nothing

Can two or more lightbeams (from a laser for example) have visible interference when they cross in mid-air*?

Is the location of an aircraft spoiler really that vital?

What game is this character in the Pixels movie from?

Sharing referee/AE report online to point out a grievous error in refereeing

Who voices the character "Finger" in The Fifth Element?

How can a valley surrounded by mountains be fertile and rainy?

Most elegant way to write a one shot IF

How is this practical and very old scene shot?

How can my story take place on Earth without referring to our existing cities and countries?

Picking balls from urns.

Can I travel from Germany to England alone as an unaccompanied minor?

How to test CRUD and FLS in unit tests?

How did installing this RPM create a file?

Can an editor review manuscript without sending to reviewers?

Handling a player (unintentionally) stealing the spotlight

Prime parity peregrination

Was it really unprofessional of me to leave without asking for a raise first?

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?



How to create controller without creating menu in Adminhtml Magento 2


Magento 2 Custom Admin Action Redirected to DashboardIs it necessary to override _isAllowed in your Admin controller?Magento Adminhtml Controller looking for the wrong URLHow to create menu and it's controller in magento 2Magento 2: How to add a link to Stores->ConfigurationPublic actions in admin controllersOverride Magento Adminhtml ControllerMagento 2 custom Admin controller redirect to DashboardForm is not displayed on panel admin Magento 22 Different keys are being genereated, Admin Grid action column-> edit link and page created after clicking save and continue butottonMagento 2 Can't submit custom form with custom controller-action in admin order detail page






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have referred below Article to display button in my Configuration page.



https://magecomp.com/blog/add-a-button-in-magento-2-stores-configuration-with-custom-action/



In file




appcodeVendorExtensionBlockSystemConfigButton.php




there is a function where we can define our Ajax URL



public function getAjaxUrl()

return $this->getUrl(‘your action Url’);



So for this, I want to create controller in Adminhtml which i can access using action url.
but all the examples i found also creates menu in sidebar in addition to controller action.



For example this one:
https://www.maximehuran.fr/en/admin-controller-creation-with-magento-2/



Is there any way to access controller action without creating menu?



Edit:
After some modification to code, I can get into the controller using below URL:




my_backend_url/route_id/controller_name/index




but it redirects back me to Dashboard page.



As mentioned in this article:



Magento 2 Custom Admin Action Redirected to Dashboard



It's Secret Form Key issue.



We can get Secret form key only if we add controller to menu which i don't want to do!



Disabling Secret Form key is not what i prefer!










share|improve this question
























  • menu file is used to display menu in admin backend

    – Rk Rathod
    Jun 19 at 11:47











  • yes i know and i don't want to display in menu. so i have not created menu.xml file

    – Khushbu
    Jun 19 at 11:50











  • you can create controller without menu file but you can call controller using url

    – Rk Rathod
    Jun 19 at 11:54











  • yes but i am not able to call controller using url

    – Khushbu
    Jun 19 at 11:55











  • like this www.abc.com/admin/yout_route_id/controller_name

    – Rk Rathod
    Jun 19 at 12:04


















0















I have referred below Article to display button in my Configuration page.



https://magecomp.com/blog/add-a-button-in-magento-2-stores-configuration-with-custom-action/



In file




appcodeVendorExtensionBlockSystemConfigButton.php




there is a function where we can define our Ajax URL



public function getAjaxUrl()

return $this->getUrl(‘your action Url’);



So for this, I want to create controller in Adminhtml which i can access using action url.
but all the examples i found also creates menu in sidebar in addition to controller action.



For example this one:
https://www.maximehuran.fr/en/admin-controller-creation-with-magento-2/



Is there any way to access controller action without creating menu?



Edit:
After some modification to code, I can get into the controller using below URL:




my_backend_url/route_id/controller_name/index




but it redirects back me to Dashboard page.



As mentioned in this article:



Magento 2 Custom Admin Action Redirected to Dashboard



It's Secret Form Key issue.



We can get Secret form key only if we add controller to menu which i don't want to do!



Disabling Secret Form key is not what i prefer!










share|improve this question
























  • menu file is used to display menu in admin backend

    – Rk Rathod
    Jun 19 at 11:47











  • yes i know and i don't want to display in menu. so i have not created menu.xml file

    – Khushbu
    Jun 19 at 11:50











  • you can create controller without menu file but you can call controller using url

    – Rk Rathod
    Jun 19 at 11:54











  • yes but i am not able to call controller using url

    – Khushbu
    Jun 19 at 11:55











  • like this www.abc.com/admin/yout_route_id/controller_name

    – Rk Rathod
    Jun 19 at 12:04














0












0








0








I have referred below Article to display button in my Configuration page.



https://magecomp.com/blog/add-a-button-in-magento-2-stores-configuration-with-custom-action/



In file




appcodeVendorExtensionBlockSystemConfigButton.php




there is a function where we can define our Ajax URL



public function getAjaxUrl()

return $this->getUrl(‘your action Url’);



So for this, I want to create controller in Adminhtml which i can access using action url.
but all the examples i found also creates menu in sidebar in addition to controller action.



For example this one:
https://www.maximehuran.fr/en/admin-controller-creation-with-magento-2/



Is there any way to access controller action without creating menu?



Edit:
After some modification to code, I can get into the controller using below URL:




my_backend_url/route_id/controller_name/index




but it redirects back me to Dashboard page.



As mentioned in this article:



Magento 2 Custom Admin Action Redirected to Dashboard



It's Secret Form Key issue.



We can get Secret form key only if we add controller to menu which i don't want to do!



Disabling Secret Form key is not what i prefer!










share|improve this question
















I have referred below Article to display button in my Configuration page.



https://magecomp.com/blog/add-a-button-in-magento-2-stores-configuration-with-custom-action/



In file




appcodeVendorExtensionBlockSystemConfigButton.php




there is a function where we can define our Ajax URL



public function getAjaxUrl()

return $this->getUrl(‘your action Url’);



So for this, I want to create controller in Adminhtml which i can access using action url.
but all the examples i found also creates menu in sidebar in addition to controller action.



For example this one:
https://www.maximehuran.fr/en/admin-controller-creation-with-magento-2/



Is there any way to access controller action without creating menu?



Edit:
After some modification to code, I can get into the controller using below URL:




my_backend_url/route_id/controller_name/index




but it redirects back me to Dashboard page.



As mentioned in this article:



Magento 2 Custom Admin Action Redirected to Dashboard



It's Secret Form Key issue.



We can get Secret form key only if we add controller to menu which i don't want to do!



Disabling Secret Form key is not what i prefer!







magento2 adminhtml admin-controller






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 19 at 12:13







Khushbu

















asked Jun 19 at 11:42









KhushbuKhushbu

30713 bronze badges




30713 bronze badges












  • menu file is used to display menu in admin backend

    – Rk Rathod
    Jun 19 at 11:47











  • yes i know and i don't want to display in menu. so i have not created menu.xml file

    – Khushbu
    Jun 19 at 11:50











  • you can create controller without menu file but you can call controller using url

    – Rk Rathod
    Jun 19 at 11:54











  • yes but i am not able to call controller using url

    – Khushbu
    Jun 19 at 11:55











  • like this www.abc.com/admin/yout_route_id/controller_name

    – Rk Rathod
    Jun 19 at 12:04


















  • menu file is used to display menu in admin backend

    – Rk Rathod
    Jun 19 at 11:47











  • yes i know and i don't want to display in menu. so i have not created menu.xml file

    – Khushbu
    Jun 19 at 11:50











  • you can create controller without menu file but you can call controller using url

    – Rk Rathod
    Jun 19 at 11:54











  • yes but i am not able to call controller using url

    – Khushbu
    Jun 19 at 11:55











  • like this www.abc.com/admin/yout_route_id/controller_name

    – Rk Rathod
    Jun 19 at 12:04

















menu file is used to display menu in admin backend

– Rk Rathod
Jun 19 at 11:47





menu file is used to display menu in admin backend

– Rk Rathod
Jun 19 at 11:47













yes i know and i don't want to display in menu. so i have not created menu.xml file

– Khushbu
Jun 19 at 11:50





yes i know and i don't want to display in menu. so i have not created menu.xml file

– Khushbu
Jun 19 at 11:50













you can create controller without menu file but you can call controller using url

– Rk Rathod
Jun 19 at 11:54





you can create controller without menu file but you can call controller using url

– Rk Rathod
Jun 19 at 11:54













yes but i am not able to call controller using url

– Khushbu
Jun 19 at 11:55





yes but i am not able to call controller using url

– Khushbu
Jun 19 at 11:55













like this www.abc.com/admin/yout_route_id/controller_name

– Rk Rathod
Jun 19 at 12:04






like this www.abc.com/admin/yout_route_id/controller_name

– Rk Rathod
Jun 19 at 12:04











1 Answer
1






active

oldest

votes


















0














Answer which worked for me is from this article:



Magento 2 Custom Admin Action Redirected to Dashboard



We can use protected $_publicActions = ['ENTER_NAME_OF_ACTION']; to turn off form key validation for specific controller like below:



class Index extends MagentoBackendAppAction

protected $_publicActions = ['index'];

public function execute()

echo "My Hello World! Controller";





It's better to disable form key for only my controller instead of everywhere in admin panel.



Please share if anyone has any better solution.






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f278867%2fhow-to-create-controller-without-creating-menu-in-adminhtml-magento-2%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Answer which worked for me is from this article:



    Magento 2 Custom Admin Action Redirected to Dashboard



    We can use protected $_publicActions = ['ENTER_NAME_OF_ACTION']; to turn off form key validation for specific controller like below:



    class Index extends MagentoBackendAppAction

    protected $_publicActions = ['index'];

    public function execute()

    echo "My Hello World! Controller";





    It's better to disable form key for only my controller instead of everywhere in admin panel.



    Please share if anyone has any better solution.






    share|improve this answer



























      0














      Answer which worked for me is from this article:



      Magento 2 Custom Admin Action Redirected to Dashboard



      We can use protected $_publicActions = ['ENTER_NAME_OF_ACTION']; to turn off form key validation for specific controller like below:



      class Index extends MagentoBackendAppAction

      protected $_publicActions = ['index'];

      public function execute()

      echo "My Hello World! Controller";





      It's better to disable form key for only my controller instead of everywhere in admin panel.



      Please share if anyone has any better solution.






      share|improve this answer

























        0












        0








        0







        Answer which worked for me is from this article:



        Magento 2 Custom Admin Action Redirected to Dashboard



        We can use protected $_publicActions = ['ENTER_NAME_OF_ACTION']; to turn off form key validation for specific controller like below:



        class Index extends MagentoBackendAppAction

        protected $_publicActions = ['index'];

        public function execute()

        echo "My Hello World! Controller";





        It's better to disable form key for only my controller instead of everywhere in admin panel.



        Please share if anyone has any better solution.






        share|improve this answer













        Answer which worked for me is from this article:



        Magento 2 Custom Admin Action Redirected to Dashboard



        We can use protected $_publicActions = ['ENTER_NAME_OF_ACTION']; to turn off form key validation for specific controller like below:



        class Index extends MagentoBackendAppAction

        protected $_publicActions = ['index'];

        public function execute()

        echo "My Hello World! Controller";





        It's better to disable form key for only my controller instead of everywhere in admin panel.



        Please share if anyone has any better solution.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 19 at 12:19









        KhushbuKhushbu

        30713 bronze badges




        30713 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f278867%2fhow-to-create-controller-without-creating-menu-in-adminhtml-magento-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

            Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

            Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림