You are here

function boost_captcha_retrieve_captcha in Boost Captcha 6

Same name and namespace in other branches
  1. 7 boost_captcha.module \boost_captcha_retrieve_captcha()

Retrieve a captcha to be sent via AJAX to a form in a cached page.

Exits after call, meant to be called via AJAX.

Parameters

$form_id: The id of the form in which the captcha is being rebuit.

Return value

HTML corresponding to the captcha.

1 string reference to 'boost_captcha_retrieve_captcha'
boost_captcha_menu in ./boost_captcha.module
Implementation of hook_menu().

File

./boost_captcha.module, line 109

Code

function boost_captcha_retrieve_captcha($form_id) {

  // Retrieve the form
  $form_state = array(
    'storage' => NULL,
    'submitted' => FALSE,
  );

  // print ($form_id);
  $form = drupal_retrieve_form($form_id, $form_state);
  drupal_prepare_form($form_id, $form, $form_state);
  drupal_process_form($form_id, $form, $form_state);

  // print_r($form);
  $form_captcha = _boost_captcha_helper_get_form_item($form, 'captcha');
  print drupal_render($form_captcha);
  exit;
}