function spaces_form_alter in Spaces 6.3
Same name and namespace in other branches
- 5.2 spaces.module \spaces_form_alter()
- 5 spaces.module \spaces_form_alter()
- 6 spaces.module \spaces_form_alter()
- 7.3 spaces.overrides.inc \spaces_form_alter()
- 7 spaces.overrides.inc \spaces_form_alter()
Implementation of hook_form_alter().
File
- ./
spaces.overrides.inc, line 97
Code
function spaces_form_alter(&$form, &$form_state, $form_id) {
if ($space = spaces_get_space()) {
// Add our submit handler to system settings forms
if (!empty($form['#submit'])) {
$position = array_search('system_settings_form_submit', $form['#submit'], TRUE);
if ($position !== FALSE) {
$form['#submit'][$position] = 'spaces_system_settings_form_submit';
// For administrators, let them save to either the space or the preset,
// unless it looks like the buttons may have already been altered.
if (count(element_children($form['buttons'])) == 2 && spaces_access_admin_perms(array(
'administer spaces',
))) {
if ($preset = $space->controllers->variable
->get('spaces_preset_' . $space->type)) {
$preset = spaces_preset_load($preset, $space->type);
$form['buttons']['preset'] = array(
'#type' => 'submit',
'#value' => t('Save to @title', array(
'@title' => $preset->title,
)),
);
$form['buttons']['submit']['#value'] = t('Save for @name', array(
'@name' => $space
->title(),
));
$form['buttons']['reset']['#weight'] = 100;
}
}
}
}
// Add the #space value to all forms generated in a space to enable non-
// purl space-types to handle AHAH callbacks. @see spaces_ahah_check()
$form['#space'] = array(
'#type' => 'value',
'#value' => $space->type . ':' . $space->id,
);
}
}