当前位置: 首页>>代码示例>>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;未经允许,请勿转载。