0

How can I retrieve controller, module and action name within a template?

2

If your template extends \Magento\Framework\View\Element\Template then you you have access to request via $this->_request

| improve this answer | |
  • There is a method $block->getRequest() – Tomasz Kuter Apr 1 '19 at 14:28
0

easiest way is

$requestOb = $objectManager->get('Magento\Framework\App\Request\Http'); 


echo $requestOb->getModuleName();

echo $requestOb->getActionName(); 

echo $requestOb->getControllerName();
| improve this answer | |

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