I would like to create module based on other custom module. One thing that will be nice to able to do is to alter module settings form fields. Is this possible?
1 Answer
You can alter any forms using hook_form_alter()
. $form
, $form_states
, and $form_id
are the parameters it gets.
Do not forget to add the following line, at the end of your hook_form_alter()
or hook_form_FORM_ID_alter()
.
$form = system_settings_form($form);
If you don't want to add the "Save configuration" button, you have to add your custom callback submit with $form['#submit'][] = '_my_callback_form_submit';
and use code similar to the following one.
function _my_callback_form_submit($form, &$form_state) {
variable_set('my_variable_name', $form_state['values']['my_variable_name']);
}