/** * Check whether attribute instance (attribute, backend, frontend or source) has method and applicable * * @param AbstractAttribute|\Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend|\Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend|\Magento\Eav\Model\Entity\Attribute\Source\AbstractSource $instance * @param string $method * @param array $args array of arguments * @return boolean */ protected function _isCallableAttributeInstance($instance, $method, $args) { if ($instance instanceof \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend && ($method == 'beforeSave' || ($method = 'afterSave'))) { $attributeCode = $instance->getAttribute()->getAttributeCode(); if (isset($args[0]) && $args[0] instanceof \Magento\Framework\Object && $args[0]->getData($attributeCode) === false) { return false; } } return parent::_isCallableAttributeInstance($instance, $method, $args); }