_objectManager = $objectManager; $this->_instanceName = $instanceName; } /** * Create class instance with specified parameters * * @param array $data * @return \Magento\Framework\App\Config\ValueInterface * @throws \InvalidArgumentException */ public function create(array $data = []) { $model = $this->_objectManager->create($this->_instanceName, $data); if (!$model instanceof \Magento\Framework\App\Config\ValueInterface) { throw new \InvalidArgumentException('Invalid config field model: ' . $this->_instanceName); } return $model; } }