Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Form.php
Go to the documentation of this file.
1 <?php
11 
13 
19 {
23  protected $httpContext;
24 
30  public function __construct(
31  \Magento\Framework\View\Element\Template\Context $context,
32  \Magento\Framework\App\Http\Context $httpContext,
33  array $data = []
34  ) {
35  $this->httpContext = $httpContext;
36  parent::__construct($context, $data);
37  $this->_isScopePrivate = true;
38  }
39 
45  public function isEnable()
46  {
47  return !($this->httpContext->getValue(Context::CONTEXT_AUTH));
48  }
49 
55  public function getTypeSelectHtml()
56  {
57  $select = $this->getLayout()->createBlock(
58  \Magento\Framework\View\Element\Html\Select::class
59  )->setData(
60  ['id' => 'quick_search_type_id', 'class' => 'select guest-select']
61  )->setName(
62  'oar_type'
63  )->setOptions(
64  $this->_getFormOptions()
65  )->setExtraParams(
66  'onchange="showIdentifyBlock(this.value);"'
67  );
68  return $select->getHtml();
69  }
70 
76  protected function _getFormOptions()
77  {
78  $options = $this->getData('identifymeby_options');
79  if ($options === null) {
80  $options = [];
81  $options[] = ['value' => 'email', 'label' => 'Email Address'];
82  $options[] = ['value' => 'zip', 'label' => 'ZIP Code'];
83  $this->setData('identifymeby_options', $options);
84  }
85 
86  return $options;
87  }
88 
94  public function getActionUrl()
95  {
96  return $this->getUrl('sales/guest/view');
97  }
98 }
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Http\Context $httpContext, array $data=[])
Definition: Form.php:30
getData($key='', $index=null)
Definition: DataObject.php:119