Ich versuche, einen benutzerdefinierten Link in die Navigation des Kundenkontos einzufügen. Mein benutzerdefinierter Link wird in der Kontonavigation angezeigt und funktioniert auch, wird jedoch beim Klicken nicht als aktiv / aktuell angezeigt.
Unten ist der Code, den ich habe:
/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>
<argument name="path" xsi:type="string">support/customer/index</argument>
zu<argument name="path" xsi:type="string">support/customer</argument>