Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
- <body>
- <referenceBlock name="top.links">
- <block class="Your_NamespaceYour_ModulenameBlockLink" name="custom-link" after="my-account-link"/>
- </referenceBlock>
- </body>
- </page>
- namespace Your_NamespaceYour_ModulenameBlock;
- /**
- * Class Link
- *
- * @SuppressWarnings(PHPMD.DepthOfInheritance)
- */
- class Link extends MagentoFrameworkViewElementHtmlLink
- {
- /**
- * Template name
- *
- * @var string
- */
- protected $_template = 'Your_Namespace_Your_Modulename::link.phtml';
- /**
- * @param MagentoFrameworkViewElementTemplateContext $context
- * @param array $data
- */
- public function __construct(
- MagentoFrameworkViewElementTemplateContext $context,
- array $data = []
- ) {
- parent::__construct($context, $data);
- }
- /**
- * @return string
- */
- public function getHref()
- {
- return $this->getUrl('custom/controller/action');
- }
- /**
- * @return MagentoFrameworkPhrase
- */
- public function getLabel()
- {
- return __('Your custom link');
- }
- }
- <li class="link custom">
- <a <?php /* @escapeNotVerified */ echo $block->getLinkAttributes() ?>><?php echo $block->escapeHtml($block->getLabel()) ?></a>
- </li>
Add Comment
Please, Sign In to add comment