Horde_Form_Type_enum::init PHP Method

init() public method

Initialize (kind of constructor)
public init ( array $values, string | boolean $prompt = null )
$values array A hash map where the key is the internal 'value' to process and the value is the caption presented to the user
$prompt string | boolean A null value text to prompt user selecting a value. Use a default if boolean true, else use the supplied string. No prompt on false.
    function init($values, $prompt = null)
    {
        $this->setValues($values);
        if ($prompt === true) {
            $this->_prompt = Horde_Form_Translation::t("-- select --");
        } else {
            $this->_prompt = $prompt;
        }
    }

Usage Example

Ejemplo n.º 1
0
 public function init($values = null, $prompt = null)
 {
     global $conf, $registry;
     // Get list of clients, if available.
     if ($registry->hasMethod('clients/getClientSource')) {
         $source = $registry->call('clients/getClientSource');
         if (!empty($source)) {
             $results = $registry->call('clients/searchClients', array(array('')));
             $clientlist = $results[''];
             $clients = array();
             foreach ($clientlist as $client) {
                 $key = isset($client['id']) ? $client['id'] : $client['__key'];
                 $clients[$key] = isset($client[$conf['client']['field']]) ? $client[$conf['client']['field']] : '';
             }
             asort($clients);
             parent::init($clients);
         }
     }
 }
All Usage Examples Of Horde_Form_Type_enum::init