init
This commit is contained in:
Executable
+77
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/**
|
||||
* Magezon
|
||||
*
|
||||
* This source file is subject to the Magezon Software License, which is available at https://www.magezon.com/license/.
|
||||
* Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
|
||||
* If you wish to customize this module for your needs.
|
||||
* Please refer to https://www.magezon.com for more information.
|
||||
*
|
||||
* @category Magezon
|
||||
* @package Magezon_QuickOrder
|
||||
* @copyright Copyright (C) 2018 Magezon (https://www.magezon.com)
|
||||
*/
|
||||
|
||||
namespace Magezon\QuickOrder\Block;
|
||||
|
||||
use Magento\Framework\Data\Form\FormKey;
|
||||
use Magento\Framework\Exception\LocalizedException;
|
||||
|
||||
class Form extends \Magento\Framework\View\Element\Template implements \Magento\Widget\Block\BlockInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_template = 'Magezon_QuickOrder::form.phtml';
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Locale\FormatInterface
|
||||
*/
|
||||
protected $_localeFormat;
|
||||
|
||||
/**
|
||||
* @var \Magezon\QuickOrder\Helper\Data
|
||||
*/
|
||||
protected $dataHelper;
|
||||
|
||||
/**
|
||||
* @param \Magento\Framework\View\Element\Template\Context $context
|
||||
* @param \Magento\Framework\Locale\FormatInterface $localeFormat
|
||||
* @param \Magezon\QuickOrder\Helper\Data $dataHelper
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(
|
||||
\Magento\Framework\View\Element\Template\Context $context,
|
||||
\Magento\Framework\Locale\FormatInterface $localeFormat,
|
||||
\Magezon\QuickOrder\Helper\Data $dataHelper,
|
||||
protected FormKey $formKey,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
$this->_localeFormat = $localeFormat;
|
||||
$this->dataHelper = $dataHelper;
|
||||
}
|
||||
|
||||
public function toHtml()
|
||||
{
|
||||
if (!$this->dataHelper->isEnabled() || !$this->dataHelper->isGroupValid()) return;
|
||||
|
||||
return parent::toHtml();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPriceFormat()
|
||||
{
|
||||
return $this->_localeFormat->getPriceFormat();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws LocalizedException
|
||||
*/
|
||||
public function getFormKey()
|
||||
{
|
||||
return $this->formKey->getFormKey();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user