Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
captcha
Commits
85510f9a
Commit
85510f9a
authored
Oct 12, 2019
by
Fabiano Sant'Ana
Browse files
Merge commit '
e65b6f82
' into 8.x-1.x
parents
8e9d85eb
e65b6f82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
14 deletions
+12
-14
captcha.admin.inc
captcha.admin.inc
+0
-11
src/Form/CaptchaExamplesForm.php
src/Form/CaptchaExamplesForm.php
+12
-3
No files found.
captcha.admin.inc
View file @
85510f9a
...
...
@@ -4,14 +4,3 @@
* @file
* Functionality and helper functions for CAPTCHA administration.
*/
/**
* 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
,
];
}
src/Form/CaptchaExamplesForm.php
View file @
85510f9a
...
...
@@ -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_c
hallenge
(
$module
,
$challenge
);
$form
[
"challenge_
{
$i
}
"
]
=
$this
->
buildC
hallenge
(
$module
,
$challenge
);
}
}
else
{
...
...
@@ -78,7 +78,7 @@ class CaptchaExamplesForm extends FormBase {
'%challenge'
=>
$challenge
,
'%module'
=>
$module
,
]),
'challenge'
=>
_captcha_generate_example_c
hallenge
(
$module
,
$challenge
),
'challenge'
=>
$this
->
buildC
hallenge
(
$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
,
];
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment