2

I want replacement of following in Magento 2

Mage::helper("adminhtml")->getUrl("module_name/controller_name/action_name/");
  • In magento 1.,Mage::helper("adminhtml")->getUrl("module_name/controller_name/action_name/") give admin section url not base url.I guess that you want url of admin – Amit Bera Apr 1 '16 at 8:04
7

Inside controller you can get this by following way

$this->getUrl($route, $params)

Another way

Create \Magento\Backend\Helper\Data object by objectManager.


$this->_helper->getUrl($route, $params)

$this->_helper is Magento\Backend\Helper\Data

  • First solution in working quite well. Thanks – Manish Apr 1 '16 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.