Re: understanding Horde hooks

Michael J Rubinsky <[email protected]> Wed, 21 Jun 2017 13:30:01 +0000
Newsgroups gmane.comp.horde.devel
Message-ID <20170621133001.Horde.Gmgu5gv4W_2A1vC09CPH62n@h4.theupstairsroom.com>
Quoting Sebastian Birnbach <[email protected]>:

> 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: [email protected]



-- 
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject

-- 
dev mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: [email protected]
(unnamed) (application/pgp-keys, 9.1 KB) - not displayed
signature.asc (application/pgp-signature, 821 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4

iQIcBAABAgAGBQJZSnTaAAoJEJGSgkbRsxbbYkIP/0D9r6/c3qMRGRFHsa2MG8cN
fUln1+U/b2IFQL7xUahaMZKtjUzlU4Ol3Zum4e/NbVpoZOojEq/63FgYl6H5d5kF
bD6PcZMmhuIvdRohgVeGDaFhQgDGBoSJybt23NCCmL5Mpp2G94T1om/Qq5yZxA39
z0JDmVcOd1q5jbufIb+YT4u9p/66BDfuA4qAbJrdy3YXrMEdQBoga2T0uY9UZvUs
t1yO3YOJLPw1vCvBrJSAIHbNUsgTUdRdqZMOgDqmH2hHGjCQo4wcfT3RH1oIGsGS
zfOpR2Ami3QWFNWfDNSBqQQOGsE+R6Tg8YTEl1RaFbRf2XhL7TWxhEqn32ZkK4cY
nUw1FjKZ3qf41A/xRn8HBQFPyhi8i+lIUfePSr5z4dEh7+mmrONMzvu8YiWmtLiW
yjDnxDdSz4y4IVACF0Zz7BQHImpA+VRybMtxPKHAJRrh+IpIoLXd5tM2Zi5obdkW
oFIAT3qTHNQSvFD2MQB6eEOo241nr5A1IisVaIscSJ3gtLOghoc0g2EuyPvhbOtG
x6VGOIcgfinaEEOoQo7+c5XELAje/6LyJiv33AWeqLG5d2H5AdAtUMY8L/Y9qMeD
H+TQhTK/PQzdzfZZoRdF/ToFN4x5LmTKKhlGfngURNNJP5wcQy6j15j4j6TvSc53
mDRw8h2/Fdd99xqNZt38
=6etM
-----END PGP SIGNATURE-----