ElkArte Community

Title: hooks
Post by: emanuele on June 06, 2014, 12:27:25 pm
Borderline bug/standardization, for sure something to do before RC1.

The hooks of the admin pages come usually in pairs: integrate_modify_something and integrate_save_something.
Now, the integrate_modify always pass the $config_vars (almost always, there may be one or two exceptions, but not a big problem).
The integrate_save, instead, not very consistent, roughly half the time the variable is passed, half is not.

So, I'm confused. lol
Title: Re: hooks
Post by: Spuds on June 06, 2014, 08:20:01 pm
Well for sure the integrate_modify_something need the config_vars so they can add to that array and show it on the form.

Not clear that integrate_save_bingbangboom need the config_array.  Seems like that would mainly be used to check the returned $_POST values and manipulate / validate them as needed.  We could pass the config_array in the _save, I'm just not sure of the usage case (and would we just pass it as the value vs reference).  In a pinch there is the public method (should be in most of those controllers), to return the config_array, although its not the best named method for that purpose.
Title: Re: hooks
Post by: Spuds on June 06, 2014, 09:14:35 pm
Another hook thing,
Code: [Select]
call_integration_hook('integrate_list_' . $listOptions['id'], array($listOptions));
seems like that should be a PBR to be useful, otherwise not sure how to use / modify $listOptions
Title: Re: hooks
Post by: emanuele on June 08, 2014, 01:32:29 pm
nods about integrate_list.

modify/save I'd go for without passing anything just because it's less work. xD
No, seriously, the "save" should really be only for changing the POST, and in any case, the current value is set in $modSettings, so it's globally accessible anyway. The type of value is known (you are adding it).

Dunno, don't see any reason to have it.
Title: Re: hooks
Post by: Spuds on June 09, 2014, 10:22:04 am
I fixed the list options hook issue and that has been merged.

The rest should be fixed/standardized here: https://github.com/elkarte/Elkarte/pull/1619 There were a couple of ones where the config vars were copied to save_vars then manipulated and then passed, I remove all of that so take a look, mainly here: https://github.com/Spuds/Elkarte/commit/858e9acff1d4deecc4031e6045865fb711a73f51
Title: Re: hooks
Post by: emanuele on June 09, 2014, 10:32:01 am
I was wondering why there were a couple with this "copy-to-save", guess is goo.