doucuo1642 2018-08-17 15:56
浏览 176

magento2将表单保存到core_config_data

I am using magento2. I have form with few "ui_components" fields, lets say: field1, field2 ,field3 and Save button How can I save values that was enter to all fields to core_config_data?

regarding core_config_data I know that I have to use this, to save data there: use Magento\Framework\App\Config\ScopeConfigInterface;

/**
 *  @var \Magento\Framework\App\Config\Storage\WriterInterface
 */
protected $configWriter;

/**
 *
 * @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
 */
public function __construct(
    ....
    \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
    .....
)
{
    $this->configWriter = $configWriter;
}

and for calling method :

$this->configWriter->save('my/path/whatever',  $value, $scope =ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeId = 0);

I know each of the fields have its own fieldID, but how to use it to get data from it?

and how to save each of the fields values into separate core config row?

Thanks

  • 写回答

2条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料