You are here

function spaces_features_form_submit in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_admin.inc \spaces_features_form_submit()
  2. 6 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 130

Code

function spaces_features_form_submit($form_id, $form_values) {
  $available = array(
    'features' => spaces_features(),
    'settings' => spaces_settings(),
  );
  db_query('DELETE FROM {spaces_features} WHERE gid = %d', $form_values['nid']);
  foreach ($available as $type => $items) {
    foreach ($items as $id => $item) {
      if (isset($form_values[$type][$id])) {
        db_query('INSERT INTO {spaces_features} (gid, type, id, value) VALUES (%d, %d, "%s", "%s")', $form_values['nid'], $type == 'features' ? 0 : 1, $id, $form_values[$type][$id]);
      }
    }
  }
  drupal_set_message(t('Feature settings have been saved.'));
}