1 views_plugin_argument_validate_user.inc | views_plugin_argument_validate_user::options_form(&$form, &$form_state) |
Provide the default form for setting options.
Overrides views_plugin_argument_validate::options_form
File
- core/
modules/ user/ views/ views_plugin_argument_validate_user.inc, line 24 - Definition of views_plugin_argument_validate_user.
Class
- views_plugin_argument_validate_user
- Validate whether an argument is a valid user.
Code
function options_form(&$form, &$form_state) {
$form['type'] = array(
'#type' => 'radios',
'#title' => t('Type of user filter value 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->options['type'],
);
$form['restrict_roles'] = array(
'#type' => 'checkbox',
'#title' => t('Restrict user based on role'),
'#default_value' => $this->options['restrict_roles'],
);
$form['roles'] = array(
'#type' => 'checkboxes',
'#title' => t('Restrict to the selected roles'),
'#options' => array_map('check_plain', user_roles(TRUE)),
'#default_value' => $this->options['roles'],
'#description' => t('If no roles are selected, users from any role will be allowed.'),
'#states' => array(
'visible' => array(
':input[name="options[validate][options][user][restrict_roles]"]' => array('checked' => TRUE),
),
),
);
}