You are here

function captcha_questions_get_webforms in Captcha Questions 7

Helper function to find webform form_ids, adopted and adapted from the function webform_mollom_form_list() in webform.module.

Returns array keyed by webform form_ids and title, nid of the node.

2 calls to captcha_questions_get_webforms()
captcha_questions_admin_settings in ./captcha_questions.admin.inc
Implements hook_form().
captcha_questions_get_form_ids in ./captcha_questions.admin.inc
Helper function to make a list of candidates of form ids.

File

./captcha_questions.admin.inc, line 250
Functionality and helper functions for Captcha questions administration.

Code

function captcha_questions_get_webforms() {
  $forms = array();
  $webform_node_types = variable_get('webform_node_types', array(
    'webform',
  ));
  $result = db_select('node', 'n')
    ->fields('n', array(
    'nid',
    'title',
  ))
    ->condition('n.type', $webform_node_types, 'IN')
    ->execute();
  foreach ($result as $node) {
    $form_id = 'webform_client_form_' . $node->nid;
    $forms[$form_id] = array(
      'title' => t('@name form', array(
        '@name' => $node->title,
      )),
      'nid' => $node->nid,
    );
  }
  return $forms;
}