Commit e65b6f82 authored by wundo's avatar wundo Committed by wundo

Issue #3086491 by wundo, josesanmartin: Remove deprecated...

Issue #3086491 by wundo, josesanmartin: Remove deprecated _captcha_generate_example_challenge function
parent ff6ba313
......@@ -39,14 +39,3 @@ function _captcha_available_challenge_types($add_special_options = TRUE) {
}
return $captcha_types;
}
/**
* Helper function for generating an example challenge.
*/
function _captcha_generate_example_challenge($module, $type) {
return [
'#type' => 'captcha',
'#captcha_type' => $module . '/' . $type,
'#captcha_admin_mode' => TRUE,
];
}
......@@ -57,7 +57,7 @@ class CaptchaExamplesForm extends FormBase {
if ($module && $challenge) {
// Generate 10 example challenges.
for ($i = 0; $i < 10; $i++) {
$form["challenge_{$i}"] = _captcha_generate_example_challenge($module, $challenge);
$form["challenge_{$i}"] = $this->buildChallenge($module, $challenge);
}
}
else {
......@@ -78,7 +78,7 @@ class CaptchaExamplesForm extends FormBase {
'%challenge' => $challenge,
'%module' => $module,
]),
'challenge' => _captcha_generate_example_challenge($module, $challenge),
'challenge' => $this->buildChallenge($module, $challenge),
'more_examples' => [
'#markup' => Link::fromTextAndUrl($this->t('10 more examples of this challenge.'), Url::fromRoute('captcha_examples', [
'module' => $module,
......@@ -97,8 +97,17 @@ class CaptchaExamplesForm extends FormBase {
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
public function submitForm(array &$form, FormStateInterface $form_state) {}
/**
* Returns a renderable array for a given CAPTCHA challenge.
*/
protected function buildChallenge($module, $challenge) {
return [
'#type' => 'captcha',
'#captcha_type' => $module . '/' . $type,
'#captcha_admin_mode' => TRUE,
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment