subscriptionHandler = $subscriptionHandler; parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); } /** * Add additional handling after config value was saved. * * @return Value * @throws LocalizedException */ public function afterSave() { try { if ($this->isValueChanged()) { $enabled = $this->getData('value'); $enabled ? $this->subscriptionHandler->processEnabled() : $this->subscriptionHandler->processDisabled(); } } catch (\Exception $e) { $this->_logger->error($e->getMessage()); throw new LocalizedException(__('There was an error save new configuration value.')); } return parent::afterSave(); } }