tdlm
tdlm

Reputation: 597

How can I get the Module / Controller / Action for a given path from the Magento Admin area?

I am to the point where I am extending Mage_Core_Controller_Varien_Router_Standard locally in my module to have access to its match() method, but of course, from the Magento admin it is treated differently from a front-facing store.

Before I waste hours looking into this, is there a simple way to properly populate an instance of Mage_Core_Controller_Request_Http/Zend_Controller_Request_Http with the same information it is given on a normal front (read: non-admin) page load (i.e. category page, search page, cms page), but from the admin area based on the path (assuming a given store)?

Ideally, it would look something like:

/** @var $request Zend_Controller_Request_Http */
$request = Mage::getModel('namespace_module/foo')->getHttpRequestByPath($uri, $store);

Note: In the example, store is optional and '$uri' would be something like:

Not looking for hacks, but wouldn't mind a shove in the right direction. I am using Magento EE 1.11.

Upvotes: 1

Views: 2438

Answers (1)

james
james

Reputation: 792

Mage::app()->getRequest() will return Mage_Core_Controller_Request_Http. From there you can call methods like:

->getControllerName();
->getActionName();

When working with the admin store, I assume a store_id of Mage_Core_Model_App::ADMIN_STORE_ID.

Is this what you were looking to achieve, or do you have a different goal in mind?

Upvotes: 1

Related Questions