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;
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
|
show 2 more comments
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
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
|
show 2 more comments
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
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
magento2 adminhtml admin-controller
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
|
show 2 more comments
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
|
show 2 more comments
1 Answer
1
active
oldest
votes
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jun 19 at 12:19
KhushbuKhushbu
30713 bronze badges
30713 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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