You are here

function spaces_features_form_submit in Spaces 6

Same name and namespace in other branches
  1. 5.2 spaces_admin.inc \spaces_features_form_submit()
  2. 5 spaces_admin.inc \spaces_features_form_submit()
  3. 6.2 spaces_admin.inc \spaces_features_form_submit()

Submit handler for spaces features form

File

./spaces_admin.inc, line 706

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.
  asort($form_state['values']['weights']);
  $features = array();
  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();
  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.'));
}