當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Value::_afterSave方法代碼示例

本文整理匯總了PHP中Magento\Framework\App\Config\Value::_afterSave方法的典型用法代碼示例。如果您正苦於以下問題:PHP Value::_afterSave方法的具體用法?PHP Value::_afterSave怎麽用?PHP Value::_afterSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\App\Config\Value的用法示例。


在下文中一共展示了Value::_afterSave方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _afterSave

 /**
  * Actions after save
  *
  * @return $this
  */
 protected function _afterSave()
 {
     $result = parent::_afterSave();
     $valueConfig = array('' => array('is_required' => 0, 'is_visible' => 0), 'opt' => array('is_required' => 0, 'is_visible' => 1), '1' => array('is_required' => 0, 'is_visible' => 1), 'req' => array('is_required' => 1, 'is_visible' => 1));
     $value = $this->getValue();
     if (isset($valueConfig[$value])) {
         $data = $valueConfig[$value];
     } else {
         $data = $valueConfig[''];
     }
     if ($this->getScope() == 'websites') {
         $website = $this->storeManager->getWebsite($this->getScopeCode());
         $dataFieldPrefix = 'scope_';
     } else {
         $website = null;
         $dataFieldPrefix = '';
     }
     foreach ($this->_getAttributeObjects() as $attributeObject) {
         if ($website) {
             $attributeObject->setWebsite($website);
             $attributeObject->load($attributeObject->getId());
         }
         $attributeObject->setData($dataFieldPrefix . 'is_required', $data['is_required']);
         $attributeObject->setData($dataFieldPrefix . 'is_visible', $data['is_visible']);
         $attributeObject->save();
     }
     return $result;
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:33,代碼來源:Customer.php

示例2: _afterSave

 /**
  * Prepare and store cron settings after save
  *
  * @return \Magento\Tax\Model\Config\Notification
  */
 protected function _afterSave()
 {
     if ($this->isValueChanged()) {
         $this->_resetNotificationFlag(\Magento\Tax\Model\Config::XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT);
         $this->_resetNotificationFlag(\Magento\Tax\Model\Config::XML_PATH_TAX_NOTIFICATION_IGNORE_PRICE_DISPLAY);
     }
     return parent::_afterSave($this);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:13,代碼來源:Notification.php

示例3: _afterSave

 /**
  * Cron settings after save
  *
  * @return $this
  */
 protected function _afterSave()
 {
     $cronExprString = '';
     $time = explode(',', $this->_configValueFactory->create()->load('paypal/fetch_reports/time', 'path')->getValue());
     if ($this->_configValueFactory->create()->load('paypal/fetch_reports/active', 'path')->getValue()) {
         $interval = $this->_configValueFactory->create()->load(self::CRON_MODEL_PATH_INTERVAL, 'path')->getValue();
         $cronExprString = "{$time[1]} {$time[0]} */{$interval} * *";
     }
     $this->_configValueFactory->create()->load(self::CRON_STRING_PATH, 'path')->setValue($cronExprString)->setPath(self::CRON_STRING_PATH)->save();
     return parent::_afterSave();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:16,代碼來源:Cron.php

示例4: _afterSave

 /**
  * Update the default product tax class
  *
  * @return \Magento\Tax\Model\Config\TaxClass
  */
 protected function _afterSave()
 {
     $attributeCode = "tax_class_id";
     $attribute = $this->attributeFactory->create();
     $attribute->loadByCode(\Magento\Catalog\Model\Product::ENTITY, $attributeCode);
     if (!$attribute->getId()) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Invalid attribute %1', $attributeCode));
     }
     $attribute->setData("default_value", $this->getData('value'));
     $attribute->save();
     return parent::_afterSave($this);
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:17,代碼來源:TaxClass.php

示例5: _afterSave

 /**
  * @return void
  */
 public function _afterSave()
 {
     parent::_afterSave();
     $this->_cacheManager->clean(array('checkout_quote'));
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:8,代碼來源:IncludePrice.php

示例6: _afterSave

 /**
  * Check and process robots file
  *
  * @return $this
  */
 protected function _afterSave()
 {
     if ($this->getValue()) {
         $this->_directory->writeFile($this->_file, $this->getValue());
     }
     return parent::_afterSave();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:12,代碼來源:Robots.php


注:本文中的Magento\Framework\App\Config\Value::_afterSave方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。