I would like to theme CAPTCHA. How can I theme following code in theme_captcha($element)?

return '<div class="captcha">'. $element['#children'] .'</div>';

As we can see $element['#children'] has rendered HTML which I want to alter.

I have created captcha.tpl.php
Copied code from theme_captcha and made small modifications:

unset($element['captcha_widgets']['captcha_response']['#title']);
print '<div class="captcha">'. drupal_render($element) .'</div>';

Drupal_render causes infinite loop. I have tried to run element_children before drupal_render but

$children = element_children($element);
foreach ($children as $key) {
  $output .= drupal_render($element[$key]);
}

after that no infinite loop but only empty $output variable.

Comments

chaugi’s picture

I have tried described method in drupal 7 and there is no problem.

wundo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)