Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Link.php
Go to the documentation of this file.
1 <?php
7 
9 
17 class Link extends \Magento\Framework\View\Element\Html\Link\Current
18 {
22  protected $httpContext;
23 
30  public function __construct(
31  \Magento\Framework\View\Element\Template\Context $context,
32  \Magento\Framework\App\DefaultPathInterface $defaultPath,
33  \Magento\Framework\App\Http\Context $httpContext,
34  array $data = []
35  ) {
36  parent::__construct($context, $defaultPath, $data);
37  $this->httpContext = $httpContext;
38  }
39 
43  protected function _toHtml()
44  {
45  if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
46  return '';
47  }
48  return parent::_toHtml();
49  }
50 }