[horde] Pass a "enum" from hooks -> prefs.php

Jan Schneider jan at horde.org
Fri Feb 1 15:58:22 UTC 2008

Zitat von Otto Stolz <Otto.Stolz at uni-konstanz.de>:

> Hello Andreas,
> MailingListe schrieb:
>> Hello
>> i try to pass a "enum" value from a hook to prefs.php to pre-populate
>> the enum field used in prefs.php with some values obtained from
>> database. Unfortunately it does not work at all. I have set a static
>> array to test but obviously i have missed something
> Read the docu on the $prefs array, in horde/config/prefs.php.
> Then look at one of the example involving an enum, e. g. date format:
> you will see that the static list of possible values goes into
> the ['enum'] component, whilst the ['value'] component contains
> the value actually selected.
> As you can also read, the hook function will be used to supply the
> ['value'] component. So, you have not supplied any enumeration.
> If you want to supply a more dynamic list, you'd have to explicitely
> call a function directly from horde/imp/config/prefs.php to obtain
> that list and assign it directly to the ['enum'] component.
>> // user preferred 'tie to' addresses
>> $_prefs['tieto_addr'] = array(
>>      'value' => '',
>>      'locked' => false,
>>      'shared' => false,
>>      'hook' => true,
>>      'type' => 'enum',
>>      'desc' => _("Addresses to explicitly tie to this identity:
>> <em>(optional, enter each address on a new line)</em>"));
> Originally, $_prefs['tieto_addr'] has
>      'type' => 'textarea',
> I guess you are not allowed to change this, as you could
> invalidate some code targetted at interpreting that very
> value. Could any person in the know (Jan?) elaborate on
> this issue?

This preference expects a newline-separated list of addresses. You  
could use any preference type that returns this, especially types that  
return a single string only. Enum is one of these types.

> For a starter, you could try
>    'type' => 'textarea',
>    'value'=> "test1 at kwsoft.com\ntest2 at kwsoft.com",
> (i. e., a single string containing a newline-separated list).
> But then I have not the slightest idea what purpose
> $_prefs['tieto_addr'] is meant to serve, and whether this
> preference will fit your bill.


Do you need professional PHP or Horde consulting?

More information about the horde mailing list