From 393da70cea95c9988ae295846545050fae9ab1fd Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 16 Dec 2010 15:26:08 -0700 Subject: [PATCH] Ticket #9454: Add example hook for setting search_fields pref --- imp/config/hooks.php.dist | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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; -- 2.11.0