function ctools_context_user_settings_form in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 plugins/contexts/user.inc \ctools_context_user_settings_form()
1 string reference to 'ctools_context_user_settings_form'
File
- plugins/
contexts/ user.inc, line 70 - Plugin to provide a user context.
Code
function ctools_context_user_settings_form($form, &$form_state) {
$conf = $form_state['conf'];
ctools_include('dependent');
$form['type'] = array(
'#title' => t('Enter the context type'),
'#type' => 'radios',
'#options' => array(
'select' => t('Select a user'),
'current' => t('Logged in user'),
),
'#default_value' => $conf['type'],
);
$form['user'] = array(
'#title' => t('Enter a user name'),
'#type' => 'textfield',
'#maxlength' => 512,
'#autocomplete_path' => 'user/autocomplete',
'#dependency' => array(
'radio:type' => array(
'select',
),
),
);
if (!empty($conf['uid'])) {
$info = user_load($conf['uid']);
if ($info) {
$form['user']['#description'] = t('Currently set to !link', array(
'!link' => theme('username', array(
'account' => $info,
)),
));
}
}
$form['uid'] = array(
'#type' => 'value',
'#value' => $conf['uid'],
);
$form['set_identifier'] = array(
'#type' => 'checkbox',
'#default_value' => FALSE,
'#title' => t('Reset identifier to username'),
'#description' => t('If checked, the identifier will be reset to the user name of the selected user.'),
'#dependency' => array(
'radio:context[context_settings][type]' => array(
'select',
),
),
);
return $form;
}