You are here

function views_bulk_operations_profile_action_validate in Views Bulk Operations (VBO) 6

Same name and namespace in other branches
  1. 6.3 profile.action.inc \views_bulk_operations_profile_action_validate()

File

actions/profile.action.inc, line 63

Code

function views_bulk_operations_profile_action_validate($form, $form_state) {
  $at_least_one = FALSE;
  foreach (profile_categories() as $category) {
    $result = _profile_get_fields($category['name']);
    while ($field = db_fetch_object($result)) {
      if (!$form_state['values'][$field->name . '_check']) {
        continue;
      }
      $at_least_one = TRUE;
      if ($form_state['values'][$field->name]) {
        if ($field->type == 'url') {
          if (!valid_url($form_state['values'][$field->name], TRUE)) {
            form_set_error($field->name, t('The value provided for %field is not a valid URL.', array(
              '%field' => $field->title,
            )));
          }
        }
      }

      //      else if ($field->required && !user_access('administer users')) {
      //        form_set_error($field->name, t('The field %field is required.', array('%field' => $field->title)));
      //      }
    }
  }
  if (!$at_least_one) {
    form_set_error('', t('You must select at least one field to modify.'));
  }
}