How to get link immediate to a tab in product in magento 2
Question
I have a Grid View using UI and i want when click edit a record in this grid, it redirect immediate to tab custom option in Product(#product_info_tabs_customer_options).
In Magento 1.x, i create link when pass params as 'params' => array('tab' => 'id_of_tab')
in function getUrl.
In Magento 2, What do i should to pass params in function getUrl ?
Thanks in advance.
Solution
The url should contain /active_tab/order_creditmemos/
where 'order_creditmemos' is the name attribute of the tab
<a href="#sales_order_view_tabs_order_creditmemos_content" ... name="order_creditmemos" ...>
See /app/code/Magento/Sales/Block/Adminhtml/Order/Creditmemo/View.php
/**
* Retrieve back url
*
* @return string
*/
public function getBackUrl()
{
return $this->getUrl(
'sales/order/view',
[
'order_id' => $this->getCreditmemo() ? $this->getCreditmemo()->getOrderId() : null,
'active_tab' => 'order_creditmemos'
]
);
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange