function user_badges_settings_form in User Badges 7
Same name and namespace in other branches
- 5 user_badges.module \user_badges_settings_form()
- 6.2 user_badges.admin.inc \user_badges_settings_form()
- 6 user_badges.admin.inc \user_badges_settings_form()
- 7.4 includes/user_badges.admin.inc \user_badges_settings_form()
- 7.2 user_badges.admin.inc \user_badges_settings_form()
- 7.3 user_badges.admin.inc \user_badges_settings_form()
Form for general module settings.
1 string reference to 'user_badges_settings_form'
- user_badges_menu in ./
user_badges.module - Implements hook_menu().
File
- ./
user_badges.admin.inc, line 705 - @brief User Badges admin functions
Code
function user_badges_settings_form($form, &$form_state) {
$noyes = array(
t('No'),
t('Yes'),
);
$form['showone'] = array(
'#type' => 'textfield',
'#title' => t('Number of badges to display'),
'#size' => 4,
'#maxlength' => 4,
'#default_value' => variable_get('user_badges_showone', 0),
'#description' => t('Only this many badges with the lightest weights will be shown.') . t('Set to zero to apply no limit.') . t('Note that if multiple badges have the same lightest weight, only one of them will appear (first by alphabetical order).'),
);
$form['showblocked'] = array(
'#type' => 'radios',
'#options' => $noyes,
'#title' => t('Only show blocked user badge'),
'#default_value' => variable_get('user_badges_showblocked', 0),
'#description' => t('If checked, only the badge associated to blocked users will be shown, overriding other badges the user eventually has as well as any other settings.') . ' ' . t('Note that if there is no badge associated to blocked users, no badges will appear.') . ' ' . t('This option only acts on blocked users and has no repercussions on active user badges.'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['userweight'] = array(
'#type' => 'radios',
'#options' => $noyes,
'#title' => t('Allow users to reorder badges'),
'#default_value' => variable_get('user_badges_userweight', 0),
'#description' => t('If checked, users will have the ability to reweight their badges in their profile, enabling them to set what order their badges display, and also which badges will display if a limit is set above.') . ' ' . t('Note that you can make individual badges exempt from this function, allowing you to force them to the top or bottom of the list by giving them a very high or low weight value.'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['show_users'] = array(
'#type' => 'radios',
'#options' => $noyes,
'#title' => t('Show users in badge list'),
'#default_value' => variable_get('user_badges_list_show_users', 0),
'#description' => t('If selected, the user badges list will include all of the users who have been assigned the badge.'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['imagecache'] = array(
'#type' => 'select',
'#options' => image_style_options(),
'#title' => t('Image style to size badges'),
'#default_value' => variable_get('user_badges_imagecache', ''),
'#description' => t('This determines the size of the image display.'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
$form['nobadges'] = array(
'#type' => 'textfield',
'#title' => t('"No badges" message'),
'#size' => 60,
'#maxlength' => 500,
'#default_value' => variable_get('user_badges_nobadges', ''),
'#description' => t('This provides this message if the user has no badges, rather than nothing. Leave it blank for no message.'),
);
$form['defaulthref'] = array(
'#type' => 'textfield',
'#title' => t('Default badge link URL'),
'#size' => 60,
'#maxlength' => 500,
'#default_value' => variable_get('user_badges_defaulthref', ''),
'#description' => t('Enter a default URL to link all badges to. You can override this for individual badges.'),
);
// Tokens help.
if (module_exists('token')) {
include_once drupal_get_path('module', 'user_badges') . '/user_badges.tokens.inc';
$form['token_help'] = array(
'#title' => t('Replacement patterns'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['token_help']['help'] = array(
'#theme' => 'token_tree',
'#token_types' => array(
'userbadge',
'user',
),
);
}
else {
$form['token_help']['help'] = array(
// Ignore Coder flag on link.
'#value' => t('Install the <a href="!link">Token</a> module if you want this URL to include dynamic elements such as badge ID numbers.', array(
'!link' => url('http://drupal.org/project/token', array(
'absolute' => TRUE,
)),
)),
);
}
// Let the user select a vocabulary to associate with badges.
if (module_exists('taxonomy')) {
//Build the options for the element
$vocabs = taxonomy_get_vocabularies();
$selects = array(
'' => t('<none>'),
);
foreach ($vocabs as $vid => $vocab) {
$selects[$vid] = $vocab->name;
}
$form['vid'] = array(
'#type' => 'radios',
'#title' => t('Vocabulary'),
'#default_value' => variable_get('user_badges_vid', ''),
'#options' => $selects,
'#description' => t('Optional. Select a vocabulary to associate badges with. You can optionally associate each badge with one term in this vocabulary.'),
'#attributes' => array(
'class' => array(
'container-inline',
),
),
);
}
$form[] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#weight' => 100,
);
return $form;
}