function theme_captcha in CAPTCHA 7
Same name and namespace in other branches
- 6.2 captcha.module \theme_captcha()
Theme function for a CAPTCHA element.
Render it in a fieldset if a description of the CAPTCHA is available. Render it as is otherwise.
File
- ./
captcha.module, line 368 - This module enables basic CAPTCHA functionality: administrators can add a CAPTCHA to desired forms that users without the 'skip CAPTCHA' permission (typically anonymous visitors) have to solve.
Code
function theme_captcha($variables) {
$element = $variables['element'];
if (empty($element['#description']) && !empty($element['#attributes']['title'])) {
// Fix for Bootstrap-based themes.
$element['#description'] = $element['#attributes']['title'];
}
if (!empty($element['#description']) && isset($element['captcha_widgets'])) {
$fieldset = array(
'#type' => 'fieldset',
'#title' => t('CAPTCHA'),
'#description' => $element['#description'],
'#children' => drupal_render_children($element),
'#attributes' => array(
'class' => array(
'captcha',
),
),
);
return theme('fieldset', array(
'element' => $fieldset,
));
}
else {
return '<div class="captcha">' . drupal_render_children($element) . '</div>';
}
}