/**
  * @inheritDoc
  */
 public function delete(DesignConfigInterface $designConfig)
 {
     if (!($designConfig->getExtensionAttributes() && $designConfig->getExtensionAttributes()->getDesignConfigData())) {
         throw new LocalizedException(__('Can not save empty config'));
     }
     $this->configStorage->delete($designConfig);
     $this->reinitableConfig->reinit();
     $this->reindexGrid();
     return $designConfig;
 }
 /**
  * Saves currency symbol to config
  *
  * @param  $symbols array
  * @return $this
  */
 public function setCurrencySymbolsData($symbols = [])
 {
     foreach ($this->getCurrencySymbolsData() as $code => $values) {
         if (isset($symbols[$code])) {
             if ($symbols[$code] == $values['parentSymbol'] || empty($symbols[$code])) {
                 unset($symbols[$code]);
             }
         }
     }
     if ($symbols) {
         $value['options']['fields']['customsymbol']['value'] = serialize($symbols);
     } else {
         $value['options']['fields']['customsymbol']['inherit'] = 1;
     }
     $this->_configFactory->create()->setSection(self::CONFIG_SECTION)->setWebsite(null)->setStore(null)->setGroups($value)->save();
     $this->_eventManager->dispatch('admin_system_config_changed_section_currency_before_reinit', ['website' => $this->_websiteId, 'store' => $this->_storeId]);
     // reinit configuration
     $this->_coreConfig->reinit();
     $this->_storeManager->reinitStores();
     $this->clearCache();
     //Reset symbols cache since new data is added
     $this->_symbolsData = [];
     $this->_eventManager->dispatch('admin_system_config_changed_section_currency', ['website' => $this->_websiteId, 'store' => $this->_storeId]);
     return $this;
 }
 /**
  * Save api credentioals.
  *
  * @param $apiUser
  * @param $apiPass
  *
  * @return bool
  */
 public function saveApiCreds($apiUser, $apiPass)
 {
     $this->helper->saveConfigData(Config::XML_PATH_CONNECTOR_API_ENABLED, '1', 'default', 0);
     $this->helper->saveConfigData(Config::XML_PATH_CONNECTOR_API_USERNAME, $apiUser, 'default', 0);
     $this->helper->saveConfigData(Config::XML_PATH_CONNECTOR_API_PASSWORD, $apiPass, 'default', 0);
     //Clear config cache
     $this->config->reinit();
     return true;
 }
示例#4
0
 /**
  * Reinit and reset Config Data
  *
  * @return $this
  */
 public function resetConfig()
 {
     $this->_config->reinit();
     $this->_dirCache = [];
     $this->_baseUrlCache = [];
     $this->_urlCache = [];
     return $this;
 }
示例#5
0
 /**
  * Ensure changes in the configuration, if any, take effect
  *
  * @return void
  */
 protected function _refreshConfig()
 {
     $this->_cache->clean();
     $this->_config->reinit();
 }