コード例 #1
0
 /**
  * @param Context $context
  * @param array $data
  */
 public function __construct(Context $context, array $data = [])
 {
     $this->_assetRepo = $context->getAssetRepository();
     $this->_localeDate = $context->getLocaleDate();
     $this->_layout = $context->getLayout();
     parent::__construct($data);
     $this->loadAttributeOptions()->loadOperatorOptions()->loadValueOptions();
     $options = $this->getAttributeOptions();
     if ($options) {
         foreach (array_keys($options) as $attr) {
             $this->setAttribute($attr);
             break;
         }
     }
     $options = $this->getOperatorOptions();
     if ($options) {
         foreach (array_keys($options) as $operator) {
             $this->setOperator($operator);
             break;
         }
     }
 }
コード例 #2
0
 public function __construct(\Ess\M2ePro\Model\Factory $modelFactory, \Ess\M2ePro\Helper\Factory $helperFactory, \Magento\Rule\Model\Condition\Context $context, array $data = [])
 {
     $this->modelFactory = $modelFactory;
     $this->helperFactory = $helperFactory;
     $this->_assetRepo = $context->getAssetRepository();
     $this->_localeDate = $context->getLocaleDate();
     $this->_layout = $context->getLayout();
     parent::__construct($data);
     $this->loadAttributeOptions()->loadOperatorOptions()->loadValueOptions();
     if ($options = $this->getAttributeOptions()) {
         foreach ($options as $attr => $dummy) {
             $this->setAttribute($attr);
             break;
         }
     }
     if ($options = $this->getOperatorOptions()) {
         foreach ($options as $operator => $dummy) {
             $this->setOperator($operator);
             break;
         }
     }
 }