You are here

function captcha_get_form_id_setting in CAPTCHA 8

Same name and namespace in other branches
  1. 6.2 captcha.inc \captcha_get_form_id_setting()
  2. 7 captcha.inc \captcha_get_form_id_setting()

Get the CAPTCHA setting for a given form_id.

Parameters

string $form_id: The form_id to query for.

bool $symbolic: Flag to return as (symbolic) strings instead of object.

Return value

null|CaptchaPoint NULL if no setting is known captcha point object with fields 'module' and 'captcha_type'. If argument $symbolic is true, returns 'default' or in the form 'captcha/Math'.

3 calls to captcha_get_form_id_setting()
CaptchaAdminTest::assertCaptchaSetting in tests/src/Functional/CaptchaAdminTest.php
Helper function for checking CAPTCHA setting of a form.
CaptchaAdminTest::testCaptchaPointSettingGetterAndSetter in tests/src/Functional/CaptchaAdminTest.php
Test the CAPTCHA point setting getter/setter.
image_captcha_after_build_process in image_captcha/image_captcha.module
Add image refresh button to captcha form element.

File

./captcha.inc, line 57
General CAPTCHA functionality and helper functions.

Code

function captcha_get_form_id_setting($form_id, $symbolic = FALSE) {

  /* @var CaptchaPoint $captchaPoint */
  $captcha_point = CaptchaPoint::load($form_id);
  if ($symbolic) {
    $captcha_point = $captcha_point
      ->getCaptchaType();
  }
  return $captcha_point;
}