You are here

function theme_captcha in CAPTCHA 6.2

Same name and namespace in other branches
  1. 7 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 336
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($element) {
  if (!empty($element['#description']) && isset($element['captcha_widgets'])) {
    $fieldset = array(
      '#type' => 'fieldset',
      '#title' => t('CAPTCHA'),
      '#description' => $element['#description'],
      '#children' => $element['#children'],
      '#attributes' => array(
        'class' => 'captcha',
      ),
    );
    return theme('fieldset', $fieldset);
  }
  else {
    return '<div class="captcha">' . $element['#children'] . '</div>';
  }
}