[imp] Hooks for search_sources/search_fields

Jan Schneider jan at horde.org
Wed Jun 8 15:32:52 UTC 2011


Zitat von Marco <falon at csi.it>:

> Hi,
>  I have the IMP 5.0.5 hooks for search_sources/search_fields.
> I don't want to search all field mapped in turba, so I tried to restrict
> search to 'search' fields.
>
> So I replaced
>
>   $out[$source] = array_keys($GLOBALS['registry']
>   ->call('contacts/fields', array($source)));
>
> (line 80 of hooks.php.dist) with
>
>   $out[$source] = $GLOBALS['cfgSources'][$source]['search'];
>
> I also tried
>
>  foreach ($GLOBALS['registry']->call('contacts/fields', array($source))
>     as $field)
>  if ($field['search']) $out[$source][] = $field['name'];
>
> Both replacement work in php admin shell on horde, they give the  
> right result.
> But only the original line works. No search for autocomplete address has done
> with one of these two replacements.

The search_fields preference expects a json-encoded array. Just pass  
$out through json_encode().

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the imp mailing list