[dev] understanding Horde hooks

Michael J Rubinsky mrubinsk at horde.org
Wed Jun 21 13:30:01 UTC 2017


Quoting Sebastian Birnbach <birnbacs at gmail.com>:

> I am trying to get an understanding of horde hooks and here is what I fould
> out so far.
>
> 1.) For customisation there are predefined methods in hooks.php and the
> list of methods cannot be extended.

Correct.

>
> 2.) If I got
> https://wiki.horde.org/CustomizingPreferencesH5?referrer=CustomizingPreferences#toc1
> right, a hook method can be implemented for every user preference in the
> $prefs object, so that the corresponding method is called upon every read
> operation of the preference.
>
> For instance, a hook to a hypothetical whups preference "some_pref" would
> require the line
> "$_prefs['some_pref']['hook'] = true;"
> in whups/config/prefs.php.
>
> The implementation would be done in whups/config/hooks.php:
> public function some_pref() {
>   return "here goes your value";
> }

Not quite.

You are correct in setting $_prefs['some_pref']['hook'] = true; but  
you don't add a new hook method. Setting this prefs to true will cause  
the "pref_init" hook to fire on login. You would detect the pref you  
are interested in using some conditional statement within this hook.  
The hook is defined in the hooks.php file of the application that the  
pref belongs to.

>
>
> Is this correct? Is there more to it? Any other resources?

This is all described in the horde/config/hooks.php file.


> Kind regards
>
>   birnbacs
> --
> dev mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 9272 bytes
Desc: PGP Public Key
URL: <https://lists.horde.org/archives/dev/attachments/20170621/4e840bab/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 821 bytes
Desc: PGP Digital Signature
URL: <https://lists.horde.org/archives/dev/attachments/20170621/4e840bab/attachment-0001.bin>


More information about the dev mailing list