Example #1
0
 /**
  * {@inheritdoc}
  */
 public function validate($object)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'validate');
     if (!$pluginInfo) {
         return parent::validate($object);
     } else {
         return $this->___callPlugins('validate', func_get_args(), $pluginInfo);
     }
 }
 /**
  * Automaticaly assign backend model to weee attributes
  *
  * @param   \Magento\Framework\Event\Observer $observer
  * @return  $this
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     $backendModel = \Magento\Weee\Model\Attribute\Backend\Weee\Tax::getBackendModelName();
     /** @var $object \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */
     $object = $observer->getEvent()->getAttribute();
     if ($object->getFrontendInput() == 'weee') {
         $object->setBackendModel($backendModel);
         if (!$object->getApplyTo()) {
             $applyTo = [];
             foreach ($this->productType->getOptions() as $option) {
                 if ($this->productTypeConfig->isProductSet($option['value'])) {
                     continue;
                 }
                 $applyTo[] = $option['value'];
             }
             $object->setApplyTo($applyTo);
         }
     }
     return $this;
 }
Example #3
0
 public function testGetBackendModelName()
 {
     $this->assertEquals('Magento\\Weee\\Model\\Attribute\\Backend\\Weee\\Tax', $this->model->getBackendModelName());
 }