?
avatar richard67
richard67
25 Apr 2020

Steps to reproduce the issue

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.

avatar richard67 richard67 - open - 25 Apr 2020
avatar joomla-cms-bot joomla-cms-bot - change - 25 Apr 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Apr 2020
avatar wilsonge wilsonge - change - 18 Dec 2020
Labels Added: ?
avatar wilsonge wilsonge - labeled - 18 Dec 2020
avatar joomdonation
joomdonation - comment - 9 Mar 2021

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?

avatar Fedik
Fedik - comment - 9 Mar 2021

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 😄

avatar richard67 richard67 - change - 9 Mar 2021
The description was changed
avatar richard67 richard67 - edited - 9 Mar 2021
avatar richard67
richard67 - comment - 9 Mar 2021

Well, I had created this issue here on @wilsonge 's request ... so maybe he should check the above comment 😄

avatar joomdonation
joomdonation - comment - 9 Mar 2021

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.

avatar wilsonge wilsonge - close - 15 Mar 2021
avatar wilsonge
wilsonge - comment - 15 Mar 2021

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)

avatar wilsonge wilsonge - change - 15 Mar 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-03-15 00:47:34
Closed_By wilsonge
avatar wilsonge wilsonge - change - 15 Mar 2021
Labels Removed: ?
avatar wilsonge wilsonge - unlabeled - 15 Mar 2021
avatar Fedik
Fedik - comment - 15 Mar 2021

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

Add a Comment

Login with GitHub to post a comment