You are here

function spaces_og_plugin_argument_validate_useringroups::validate_form in Spaces 6.3

Same name and namespace in other branches
  1. 7.3 spaces_og/views/spaces_og_plugin_argument_validate_useringroups.inc \spaces_og_plugin_argument_validate_useringroups::validate_form()
  2. 7 spaces_og/views/spaces_og_plugin_argument_validate_useringroups.inc \spaces_og_plugin_argument_validate_useringroups::validate_form()

File

spaces_og/views/spaces_og_plugin_argument_validate_useringroups.inc, line 9

Class

spaces_og_plugin_argument_validate_useringroups
Validate whether an argument is a valid user that is a member of one of the current user's groups. This check works through the implementation of db_rewrite_sql() in spaces_og.

Code

function validate_form(&$form, &$form_state) {

  // We are unable to rely on options having already been set, so let's make
  // sure defaults are here:
  if (!isset($this->argument->options['validate_user_argument_type'])) {
    $this->argument->options['validate_user_argument_type'] = 'uid';
  }
  $form['validate_user_argument_type'] = array(
    '#type' => 'radios',
    '#title' => t('Type of user argument to allow'),
    '#options' => array(
      'uid' => t('Only allow numeric UIDs'),
      'name' => t('Only allow string usernames'),
      'either' => t('Allow both numeric UIDs and string usernames'),
    ),
    '#default_value' => $this->argument->options['validate_user_argument_type'],
    '#process' => array(
      'expand_radios',
      'views_process_dependency',
    ),
    '#dependency' => array(
      'edit-options-validate-type' => array(
        $this->id,
      ),
    ),
    '#prefix' => '<div id="edit-options-validate-user-argument-type-wrapper">',
    '#suffix' => '</div>',
  );
}