MYTHEME/theme-settings.php: THEME_form_system_theme_settings_alter() builds an input form for /admin/appearance/THEME and the input (values) of the user will not be known by Drupal nor by theme_get_settings() before saving the user given input.
I'm kind of curious how to pass this value to THEME_form_system_theme_settings_submit() in theme-settings.php?
In other words: I need the value from the user input of the theme settings form BEFORE we leave theme-settings.php - Is that possible? Or do I need another way around this?
Test: Let's say the value gets stored in a 'textfield', build by the THEME_form_system_theme_settings_alter() function:
// theme-settings.php
function THEME_form_system_theme_settings_alter(&$form, &$form_state) {
// Test form
$form['whatever_fieldset_group']['user_input'] = array(
'#type' => 'textfield',
'#title' => t('Test to get value'),
'#default_value' => theme_get_setting('user_input'),
'#description' => t('
Type some text in textfield
to get shown in submit message'),
);
}
To test if I can pass that value to THEME_form_system_theme_settings_submit() we try to show the value of this field in a submit message:
// theme-settings.php
function THEME_form_system_theme_settings_submit($form, &$form_state) {
// the following will not work inside theme-settings.php
// because value is not known yet by theme_get_setting()
$data = theme_get_setting('user_input');
drupal_set_message(
'For testing purposes we submit that you have
filled the textfield with the following
mindless value: '.$data
);
}
This will not work. Of course. And variable_get() and variabel_set() seems to be no option ether, because we can not fill any variable without knowing the value in theme-settings.php.
The reason for asking this is, I want to write css from user input in a css file while saving theme settings. Maybe there is a way to fire a function after theme-settings got saved? Not sure. Maybe I need more examples of custom themes and how they solved it there without an additional module ...
$data = $form_state['values']['user_input'];
.