I am trying to add a custom link in customer account navigation. My custom link is showing in account navigation and working too, but it's not showing as active/current on click.
Below is the code I have:
/app/code/Namespace/Support/view/frontend/layout/customer_account.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer_account_navigation">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-suppport-ticket-link" after="-">
<arguments>
<argument name="path" xsi:type="string">support/customer/index</argument>
<argument name="label" xsi:type="string">Support Ticket</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
/app/code/Namespace/Support/Controller/Customer/Index.php
<?php
namespace Namespace\Support\Controller\Customer;
use Magento\Framework\App\Action;
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\Controller\ResultFactory;
class Index extends \Namespace\Support\Controller\Index
{
/**
* Show customer tickets
*
* @return \Magento\Framework\View\Result\Page
* @throws NotFoundException
*/
public function execute()
{
/** @var \Magento\Framework\View\Result\Page resultPage */
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
return $resultPage;
}
}
/app/code/Namespace/Support/view/frontend/layout/support_customer_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<head>
<title>Support Ticket</title>
<css src="Namespace_Support::css/styles.css"/>
</head>
<body>
<referenceContainer name="content">
<block class="Namespace\Support\Block\TicketList" name="ticketViewList" template="Namespace_Support::list.phtml" />
</referenceContainer>
</body>
</page>
Can anybody please help me out on this?
Thanks.