本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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);
}
示例5: _afterSave
/**
* @return void
*/
public function _afterSave()
{
parent::_afterSave();
$this->_cacheManager->clean(array('checkout_quote'));
}
示例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();
}