Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RegisterLink.php
Go to the documentation of this file.
1 <?php
7 
9 
18 {
24  protected $httpContext;
25 
29  protected $_registration;
30 
34  protected $_customerUrl;
35 
43  public function __construct(
44  \Magento\Framework\View\Element\Template\Context $context,
45  \Magento\Framework\App\Http\Context $httpContext,
46  \Magento\Customer\Model\Registration $registration,
48  array $data = []
49  ) {
50  parent::__construct($context, $data);
51  $this->httpContext = $httpContext;
52  $this->_registration = $registration;
53  $this->_customerUrl = $customerUrl;
54  }
55 
59  public function getHref()
60  {
61  return $this->_customerUrl->getRegisterUrl();
62  }
63 
67  protected function _toHtml()
68  {
69  if (!$this->_registration->isAllowed()
70  || $this->httpContext->getValue(Context::CONTEXT_AUTH)
71  ) {
72  return '';
73  }
74  return parent::_toHtml();
75  }
76 }
$customerUrl
Definition: info.phtml:28