skip to Main Content

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 MagentoFrameworkAppConfigScopeConfigInterface;

/**
 *  @var MagentoFrameworkAppConfigStorageWriterInterface
 */
protected $configWriter;

/**
 *
 * @param MagentoFrameworkAppConfigStorageWriterInterface $configWriter
 */
public function __construct(
    ....
    MagentoFrameworkAppConfigStorageWriterInterface $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

Back To Top
Search