cancel
Showing results for 
Search instead for 
Did you mean: 

getAdminLink for Magento 2

SOLVED

getAdminLink for Magento 2

Hello

 

I have a new question (a little one this time) as you probably know i'm trying to adapt a module from prestashop to magento so i'm searching the equivalent of :

$this->context->link->getAdminLink(---------);

for Magento 2:

help pls

1 ACCEPTED SOLUTION

Accepted Solutions

Re: getAdminLink for Magento 2

You can get homepage url of admin,

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
echo $objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl();

You can get other page url using,

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    	echo $objectManager->get('Magento\Backend\Model\UrlInterface')->getUrl('catalog/product/index');
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

View solution in original post

2 REPLIES 2

Re: getAdminLink for Magento 2

You can get homepage url of admin,

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
echo $objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl();

You can get other page url using,

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
    	echo $objectManager->get('Magento\Backend\Model\UrlInterface')->getUrl('catalog/product/index');
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: getAdminLink for Magento 2

thank you very much