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

Otto Stolz Otto.Stolz at uni-konstanz.de
Fri Feb 1 14:58:08 UTC 2008

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?

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.

Best wishes,
   Otto Stolz

More information about the horde mailing list