Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Sidebar.php
Go to the documentation of this file.
1 <?php
7 
9 
17 {
21  protected $httpContext;
22 
28  public function __construct(
29  \Magento\Framework\View\Element\Template\Context $context,
30  \Magento\Framework\App\Http\Context $httpContext,
31  array $data = []
32  ) {
33  parent::__construct($context, $data);
34  $this->httpContext = $httpContext;
35  }
36 
43  public function getFormActionUrl()
44  {
45  return $this->getUrl('checkout/cart/addgroup', ['_secure' => true]);
46  }
47 
53  protected function _toHtml()
54  {
55  $isValid = $this->httpContext->getValue(Context::CONTEXT_AUTH) || $this->getCustomerId();
56  return $isValid ? parent::_toHtml() : '';
57  }
58 }
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Http\Context $httpContext, array $data=[])
Definition: Sidebar.php:28