From: Michael M Slusarz Date: Thu, 16 Dec 2010 22:26:08 +0000 (-0700) Subject: Ticket #9454: Add example hook for setting search_fields pref X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=393da70cea95c9988ae295846545050fae9ab1fd;p=horde.git Ticket #9454: Add example hook for setting search_fields pref --- diff --git a/imp/config/hooks.php.dist b/imp/config/hooks.php.dist index 2deab44fb..4d2ab828e 100644 --- a/imp/config/hooks.php.dist +++ b/imp/config/hooks.php.dist @@ -63,16 +63,26 @@ class IMP_Hooks // : $GLOBALS['registry']->call('contacts/getDefaultShare'); // // +// case 'search_fields': // case 'search_sources': -// // Dynamically set the search_sources preference. +// // Dynamically set the search_fields/search_sources preferences. // // // Example #1: Use the list of sources defined in the contacts -// // application (e.g. Turba) to populate the search_sources -// // value. +// // application (e.g. Turba). // if (!is_null($username) && // $GLOBALS['registry']->hasMethod('contacts/sources')) { // $sources = $GLOBALS['registry']->call('contacts/sources'); -// return json_encode(array_keys($sources)); +// +// if ($pref == 'search_fields') { +// $out = array(); +// foreach (array_keys($sources) as $source) { +// $out[$source] = array_keys($GLOBALS['registry']->call('contacts/fields', array($source))); +// } +// } else { +// $out = array_keys($sources); +// } +// +// return json_encode($out); // } // // return $value;