function foo_captcha_captcha in CAPTCHA Pack 8
Same name and namespace in other branches
- 5 foo_captcha/foo_captcha.module \foo_captcha_captcha()
- 6 foo_captcha/foo_captcha.module \foo_captcha_captcha()
- 7 foo_captcha/foo_captcha.module \foo_captcha_captcha()
Implements hook_captcha().
File
- foo_captcha/
foo_captcha.module, line 21 - Contains general functionality of the module.
Code
function foo_captcha_captcha($op, $captcha_type = '') {
switch ($op) {
case 'list':
return [
'Foo CAPTCHA',
];
case 'generate':
if ($captcha_type == 'Foo CAPTCHA') {
$captcha = [];
$captcha['solution'] = 'foo';
$captcha['form']['captcha_response'] = [
'#type' => 'textfield',
'#title' => t('Enter "foo"'),
'#required' => TRUE,
'#process' => [
'foo_captcha_process',
],
'#cache' => [
'max-age' => 0,
],
];
\Drupal::service('page_cache_kill_switch')
->trigger();
return $captcha;
}
break;
}
}