I enabled the path template suggestion and It doesn't show the path for the 'Create an account' link. Reading the html home page source I've saw these tags:

<ul class="header links">
    <li class="greet welcome" data-bind="scope: 'customer'">
        <!-- ko if: customer().fullname  -->
        <span data-bind="text: new String('Benvenuto, %1!').replace('%1', customer().firstname)">
        <!-- /ko -->
        <!-- ko ifnot: customer().fullname  -->
        <span data-bind="html:'Testo di benvenuto predefinito!'"></span>
        <!-- /ko -->
<li class="authorization-link" data-label="o">
    <a href="https://mysiteurl/index.php/customer/account/login/">
        Login    </a>

<li><a href="https://mysiteurl/index.php/customer/account/create/" >Create an account</a></li></ul>

This is the path for the greeting block:


For the Login block:


Where is the 'create an account' phtml file that contains the 'li' tag?

1 Answer 1


The link does not come from a template file.
It is added via layout (view/frontend/layout/default.xml from the customer module) via these lines:

        <block class="Magento\Customer\Block\Account\RegisterLink" name="register-link">
                <argument name="label" xsi:type="string" translate="true">Create an Account</argument>

The link is rendered via the method Magento\Customer\Block\Account\RegisterLink::_toHtml which calls the parent class _toHtml method. Parent class is Magento\Framework\View\Element\Html\Link and the method looks like this:

protected function _toHtml()
    if (false != $this->getTemplate()) {
        return parent::_toHtml();

    return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';

there is no template for the register link block so it gets rendered by this line return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';

  • The method _toHtml() contains a : #<li class="nav item'#, I don't think it is the right method.
    – blob
    May 6, 2019 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.