You are here

function spaces_features_form_validate in Spaces 5

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

Validate handler for spaces features form

File

./spaces_admin.inc, line 112

Code

function spaces_features_form_validate($form_id, $form_values) {
  $enabled_features = array_sum($form_values['features']);
  if (!$enabled_features) {
    return form_set_error('', t('You must enable at least 1 feature for this group.'));
  }
  if (!$form_values['settings']['spaces_home']) {
    return form_set_error('settings][spaces_home', t('You must choose a homepage for this group.'));
  }
  else {
    if ($homepage = $form_values['settings']['spaces_home']) {
      if (!$form_values['features'][$homepage]) {
        return form_set_error('settings][spaces_home', t('You must choose an enabled feature for use as this group\'s homepage.'));
      }
    }
  }
}