J3 Issue ?
avatar tonypartridge
tonypartridge
23 Oct 2018

Curious, in the new joomla actions logs we are running onUserAfterSaveGroup see:

public function onUserAfterSaveGroup($context, $table, $isNew)
{
	$context = $this->app->input->get('option');

But as you can see we are overwriting context instantly? Why? If we need to fetch the $option shouldn't we be defining it as $option?

avatar tonypartridge tonypartridge - open - 23 Oct 2018
avatar joomla-cms-bot joomla-cms-bot - change - 23 Oct 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Oct 2018
avatar infograf768
infograf768 - comment - 23 Oct 2018

I was wondering the same.

avatar tonypartridge tonypartridge - change - 23 Oct 2018
Title
Overwritting content?
Overwritting contex?
avatar tonypartridge tonypartridge - edited - 23 Oct 2018
avatar tonypartridge tonypartridge - change - 23 Oct 2018
Title
Overwritting contex?
Overwritting context?
avatar tonypartridge tonypartridge - edited - 23 Oct 2018
avatar brianteeman brianteeman - change - 30 Oct 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 30 Oct 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 4 Mar 2019
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 29 Mar 2019
Category com_csp
avatar jwaisner jwaisner - change - 19 Mar 2020
Status Discussion New
avatar chmst chmst - change - 26 Dec 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-12-26 16:27:13
Closed_By chmst
avatar chmst chmst - close - 26 Dec 2020
avatar chmst
chmst - comment - 26 Dec 2020

Please see #31784

avatar tonypartridge
tonypartridge - comment - 6 Jan 2021

Thanks, the logic still doesn't make sense to me though. Why are we even passing in $context? is it for legacy reasons?

avatar HLeithner
HLeithner - comment - 6 Jan 2021

Because "context" is "wrongly" used, most of the time it's the extension which "owns" the data for example if you want to execute onContentAfterTitle for a com_content article you set the context 'com_content.article' even in your own component.

Which is wrong in my opinion, I would expect the context is the "situation" the event is called and that you supply a $extension for the data "owner".

I didn't checked the code but you suspect that this is the reason why we override the context with the "component" (parts of the extension).

Add a Comment

Login with GitHub to post a comment