You are here

function captcha_questions_get_form_ids in Captcha Questions 7

Helper function to make a list of candidates of form ids.

1 call to captcha_questions_get_form_ids()
captcha_questions_admin_settings in ./captcha_questions.admin.inc
Implements hook_form().

File

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

Code

function captcha_questions_get_form_ids() {

  // Some form nids that might exist on the site.
  $form_ids = array(
    'contact_site_form',
    'contact_personal_form',
    'user_register_form',
    'user_pass',
    'user_login',
    'user_login_block',
    'forum_node_form',
  );

  // Fetching form ids for all node types.
  foreach (node_type_get_names() as $type => $name) {
    $form_ids[] = 'comment_node_' . $type . '_form';
  }

  // Fetching webform form_ids
  if (module_exists('webform')) {
    $webform_forms = captcha_questions_get_webforms();
    foreach ($webform_forms as $webform_id => $webform) {
      $form_ids[] = $webform_id;
    }
  }

  // Adding custom form_ids. This will add all selected forms.
  $custom_form_ids = variable_get('captcha_questions_form_ids', array());
  foreach ($custom_form_ids as $custom_form_id) {
    $form_ids[] = $custom_form_id;
  }

  // Removing possible duplicates from last step.
  $form_ids = array_unique($form_ids);
  return $form_ids;
}