I want to display the Login and Register link in one of my custom module. I have got a solution for displaying the Login link by giving the below code in block file:
public function checkCustomerLogin()
{
$customer_data = [];
if (!$this->_customerSession->isLoggedIn()) {
$customer_data['text'] = "Login";
$customer_data['url'] = $this->_storeManager->getStore()->getUrl('customer/account/login');
} else {
$customer_data['text'] = "Logout";
$customer_data['url'] = $this->_storeManager->getStore()->getUrl('customer/account/logout');
}
return $customer_data;
}
But I haven't got a solution for displaying the register link.
Could anyone please help me to resolve this issue?