Closed (fixed)
Project:
CAPTCHA
Version:
2.x-dev
Component:
Captcha API (captcha)
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2021 at 17:22 UTC
Updated:
16 Jan 2023 at 17:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
adamps commentedComment #3
anybodyIf you'd like to alter the UI, this issue might also be relevant: #3314766: [2.x] Improve the CAPTCHA form markup and use twig files for more flexibility, where possible and a better approach for theming than the FAPI handling. So I guess we need both! :)
Comment #4
anybody@AdamPS: Isn't it possible to use hook_form_alter instead for this? Does this need an extra hook?
Comment #5
adamps commentedNo unfortunately not. When
hook_form_alter()is called, form array contains the result ofcaptcha_form_alter(), which looks something like this:The part we need to alter only gets created very late, during the final render stage.
#3314766: [2.x] Improve the CAPTCHA form markup and use twig files for more flexibility, where possible is a good idea and I look forward to it in 2.x. For the moment we only have 1.x so it would be great to have a solution that works now, thanks.
Comment #6
anybody@AdamPS thanks! Then I'd agree we should add that hook from #2!
Haven't tested it yet, but we should consider that!
Comment #7
anybody@AdamPS could you perhaps create a MR for final review?
Comment #8
anybodyLet's add this in 2.x, I think.
Comment #9
anybody@Grevil if you also think this makes sense, let's add this to 2.x please after your review.
Comment #10
anybodyComment #14
anybody@AdamPS: Please have a look at the MR. I just rerolled your patch from #2 as MR.
One thing I'm not sure about is, if we'd also may need a way to alter the $info prior to the captcha method invocation. What do you think?
In your case you need the already generated captcha?
Comment #15
grevil commentedComment #16
adamps commentedGreat thanks.
Beg pardon I don't understand what you mean by "captcha method invocation". If you are talking about
\Drupal::moduleHandler()->invoke($captcha_type_module, 'captcha'then this function doesn't actually get passed the $info, so it's not needed.Would be great to have a backport to 1.x please seeing as 2.x is not yet ready for use in production. It seems like a totally safe fix.
Comment #18
anybodyThank you @AdamPS, Merged!
Could you provide a MR to merge this into 8.x-1.x? Cherry-pick doesn't seem to work and I don't have much time currently.
Comment #19
anybodySwitching to 8.x-1.x for that.
Comment #21
adamps commentedThanks here is the MR.
Comment #22
anybodyThank you @AdamPS! Merged in 2022 :P
Comment #24
anybodyComment #25
adamps commentedGreat thanks