function spaces_features_form_submit in Spaces 6.2
Same name and namespace in other branches
- 5.2 spaces_admin.inc \spaces_features_form_submit()
- 5 spaces_admin.inc \spaces_features_form_submit()
- 6 spaces_admin.inc \spaces_features_form_submit()
Submit handler for spaces features form
File
- ./
spaces_admin.inc, line 644
Code
function spaces_features_form_submit($form, &$form_state) {
// Retrieve the space object from the form
$space = $form_state['values']['space'];
// Sort the weights array and rebuild feature values list in the
// weighted order. When the features are saved, an ascending set of
// weights will be assigned.
$features = array();
if (!empty($form_state['values']['features'])) {
asort($form_state['values']['weights']);
foreach (array_keys($form_state['values']['weights']) as $feature) {
$features[$feature] = $form_state['values']['features'][$feature];
}
}
$space->features = $features;
// Set setting values
$settings = spaces_settings();
if (!empty($form_state['values']['settings'])) {
foreach ($form_state['values']['settings'] as $setting => $value) {
$space->settings[$setting] = $settings[$setting]
->submit($space, $value);
}
}
// Save the space
spaces_save($space);
drupal_set_message(t('The space configuration has been saved successfully.'));
}