I want to create a custom top link in magento 2 for my custom module, but when i load the home page, the custom top link doesn't show up, here's my view/frontend/layout/default.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="header.links">
<block class="Lime\Confirmation\Block\Link" name="add-new-header-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">Confirm Payment</argument>
<argument name="path" xsi:type="string" translate="true">confirmation</argument>
</arguments>
</block>
</referenceBlock>
</body>
My Block/Link.php:
namespace Lime\Confirmation\Block;
class Link extends \Magento\Framework\View\Element\Html\Link
{
/**
* Render block HTML.
*
* @return string
*/
protected function _toHtml()
{
if (false != $this->getTemplate()) {
return parent::_toHtml();
}
return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';
}
}