In my installation profile, I have added a text field to the install_configure_form by including:
if (!function_exists("system_form_install_configure_form_alter")) {
function system_form_install_configure_form_alter(&$form, $form_state) {
$form['site_information']['site_name']['#default_value'] = st('Organization name');
$form['site_information']['org_short_name'] = array(
'#type' => 'textfield',
'#title' => st('Short name'),
'#description' => st('This will be used as a casual reference to the association throughout the site. If left blank, the Site name will be used.'),
'#attributes' => ['placeholder' => 'e.g. FBI'],
'#size' => 60,
'#maxlength' => 60,
);
// Move the email to the bottom
$form['site_information']['site_mail']['#weight'] = 1;
}
}
Now, I'm trying to read and persist what the user entered using a _submit function:
function my_profile_install_configure_form_submit(&$form, $form_state) {
$values = $form_state['values'];
$name = !empty($values['org_short_name']) ? $values['org_short_name'] : $values['site_name'];
variable_set('short_name', $name);
}
Unfortunately, I don't think the my_profile_install_configure_form_submit
function is getting called because the short_name
is not getting created. How should I be accessing and persisting the custom elements in that form?
Thanks!
if
statement like that; plus, you don't need to useystem_form_install_configure_form_alter
as hook name.my_profile_install_configure_form_submit()
would be called in some way. Did you show all the code you are using?system_form_install_configure_form_alter()
doesn't exist in Drupal 7. Plus, you don't use the name of another module/profile to implement a hook, if not when your code is implementing a hook for another module/profile, but that is not what the majority of the modules/profiles do.