1

enter image description here

I want to change create an account text to icon.

I can find the layout file under

var\www\html\vendor\magento\module-customer\view\frontend\layout\default.xml

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

How to change create an account text to icon

Prince Patel
23.1k10 gold badges102 silver badges124 bronze badges
asked Jan 23, 2018 at 7:13
2
  • Its working. Thx Patel Commented Jan 23, 2018 at 8:49
  • Yr Welcome.. :) Commented Jan 23, 2018 at 8:58

2 Answers 2

1

The HTML of register link is generated from block RegisterLink.php so you need to override block and add new css class in function _toHtml()

vendor/magento/module-customer/Block/Account/RegisterLink.php

protected function _toHtml()
{
 if (!$this->_registration->isAllowed()
 || $this->httpContext->getValue(Context::CONTEXT_AUTH)
 ) {
 return '';
 }
 return '<li class="register-link"><a ' . $this->getLinkAttributes() . ' ></a></li>';
}

Now add new class in css file

li.register-link:before {
 font-size: 22px;
 content: '\e611';
 font-family: 'luma-icons';
}
answered Jan 23, 2018 at 8:25
1

You can use in this way, define template to your block template="your/template/pathhere.html" and replace your/template/pathhere.html with template file path:

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

And inside your template you can use icon/image to display icon/image and can call getHref to get link url that you can use to link that icon. Also you can call $block->escapeHtml($block->getLabel()) to get label in your template.

answered Jan 23, 2018 at 8:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.