In https://api.backdropcms.org/api/backdrop/1/search/system_settings_form it mentions how you can specify a different config file for some of the form elements/values via '#config'
. What do you do though if you want to save to the same top-level '#config'
, but to a different setting?
So say that your form element is $form['my']['cool']['element'] = array( ... );
but you want the setting to be saved as my_cool_element
in the .json? ...is a custom submit handler the only option in that case?
So basically, I understand that you can do this:
$primary_config = config('mymodule.settings');
$secondary_config = config('mymodule.moar.settings');
$form = array('#config' => 'mymodule.settings');
$form['first_setting'] = array( ... );
$form['second_setting'] = array(
...
'#config' => 'mymodule.moar.settings',
...
);
...and that this saves first_setting
in mymodule.settings.json
, while second_setting
is saved in mymodule.moar.settings.json
.
What I need to do though is something like this:
$config = config('mymodule.settings');
$form = array('#config' => 'mymodule.settings');
$form['first_setting'] = array( ... );
$form['second_setting'] = array(
...
'#config_setting' => 'call_this_something_else',
...
);
...so both settings will be saved in the same mymodule.settings.json
file. The first one as "first_setting"
, while the second one as "call_this_something_else"
. So instead of this:
{
"_config_name": "mymodule.settings",
"_module": "mymodule",
"first_setting": 123,
"second_setting": "abc",
}
...I would instead want to have this:
{
"_config_name": "mymodule.settings",
"_module": "mymodule",
"first_setting": 123,
"call_this_something_else": "abc",
}
Recent comments
Tried and successfully applied DrAlbany's method with the form https://www.drupal.org/sandbox/grobot/2105379stickman hook. I also encountered the same situation. Thanks DrAlbany
Ubercart - Auto increment SKU
Since before migration you need to prepare the Drupal site - disabling and removing all modules, disabling themes, as part of the preparation you can clear the cache and logs, delete the search...
Trimming the size of my database for D2B_migrate not to error out (Request Entity Too Large / 504 Gateway Time-out)
QuickTabs is now available!!! But does not work as expected, already reported (https://github.com/backdrop-contrib/quicktabs/issues/14). Maybe an alternative solution using Views...
Quick Tabs (or method to simulate)