Pull Request (PR) #28785 has fixed the recaptcha plugin in the 4.0-dev branch so that it works again.
The fix was to use change onInit(), onDisplay(), onCheckAnswer() from events to callbacks.
But according to #28785 (comment) this is not like it was meant to be in J4.
Therefore it needs to investigate what has to be done so the callbacks can be changed back to events.
This issue is just a reminder for that so it is not forgotten.
Labels |
Added:
?
|
Labels |
Added:
?
|
tbh, I have no idea.
It not only about captcha but also about editor plugins.
Obviously it will be wrong to have onInit
, onDisplay
(etc. captcha, editor event) as global events.
at least it need a new event names, for captcha and editor.
It sounds like need to rewrite whole Joomla\CMS\Captcha
and Joomla\CMS\Editor
API.
It also should deal somehow with multiple return result from event dispatching.
I would leave it in peace until better times
Ah ah, so editor plugins also use onInit and onDisplay events. If so, Yes, I agree that we should leave it as how it is for now :D.
Fine leave it as it is :( but i really dislike the fact that not all our plugins are actually using the event system. As mentioned it's easy to move it to an events system but needs something more complicated to ensure we only get back the item from the correct plugin (passing in the name of the active editor/captcha system or similar)
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2021-03-15 00:47:34 |
Closed_By | ⇒ | wilsonge |
Labels |
Removed:
?
|
We can review it in future again.
I think, when the event dispatcher would allow to call a specific plugin, it could help much here.
Something like:
// Load all editors and captcha
PluginHelper::importPlugin('editors');
PluginHelper::importPlugin('captcha');
// Selected editor in the configuration
$context = 'editors.tinymce'; // $group + $name
// Dispatch only the events from editors/tinymce, and return only 1 result
$editorResult = $dispatcher->dispatchOneInContext($context, $eventName, $event);
// Same for a captcha
$context = 'captcha.recaptcha';
$captchaResult = $dispatcher->dispatchOneInContext($context, $eventName, $event);
But probably it not correct and it still some kind of hacky thing.
UPD: forget it is stupid idea
we can just join the results, and the plugin should check $context itself
What should we do with this Release Blocker? @Fedik Look like revert your PHP changes on your original PR #28785 and add the missing
$this->_captcha->registerListeners();
at the end of _load method of the Captcha class will have captcha still works, too. Could that be the solution?