Show
Ignore:
Timestamp:
03/19/09 10:40:34 (3 years ago)
Author:
john
Message:

features and bug fixes from gocoffeego project

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_view/helpers/form_helper.php

    r243 r308  
    131131     */ 
    132132    function add_default_name_and_id($options) {   
    133         $name_option_exists = array_key_exists('name', $options);    
    134         if(array_key_exists("index", $options)) { 
     133        $name_option_exists = array_key_exists('name', (array)$options);     
     134        if(array_key_exists("index", (array)$options)) { 
    135135            $options['name'] = $name_option_exists 
    136136                ? $options['name'] 
    137137                : $this->tag_name_with_index($options['index']); 
    138             $options['id'] = array_key_exists('id', $options) 
     138            $options['id'] = array_key_exists('id', (array)$options) 
    139139                ? $options['id'] 
    140140                : $this->tag_id_with_index($options['index']); 
     
    144144                ? $options['name'] 
    145145                : $this->tag_name_with_index($this->auto_index); 
    146             $options['id'] = array_key_exists('id', $options) 
     146            $options['id'] = array_key_exists('id', (array)$options) 
    147147                ? $options['id'] 
    148148                : $this->tag_id_with_index($this->auto_index); 
     
    151151                ? $options['name'] 
    152152                : $this->tag_name(); 
    153             $options['id'] = array_key_exists('id', $options) 
     153            $options['id'] = array_key_exists('id', (array)$options) 
    154154                ? $options['id'] 
    155155                : $this->tag_id(); 
    156156        } 
    157         if(array_key_exists('multiple', $options) && !$name_option_exists) { 
     157        if(array_key_exists('multiple', (array)$options) && !$name_option_exists) { 
    158158            $options['name'] .= "[]";            
    159159        } 
     
    181181     */ 
    182182    function to_input_field_tag($field_type, $options = array()) { 
    183         $default_size = array_key_exists("maxlength", $options) 
     183        $default_size = array_key_exists("maxlength", (array)$options) 
    184184            ? $options["maxlength"] : $this->default_field_options['size']; 
    185         $options["size"] = array_key_exists("size", $options) 
     185        $options["size"] = array_key_exists("size", (array)$options) 
    186186            ? $options["size"]: $default_size; 
    187         $options = array_merge($this->default_field_options, $options); 
     187        $options = array_merge($this->default_field_options, (array)$options); 
    188188        if($field_type == "hidden") { 
    189189            unset($options["size"]); 
     
    191191        $options["type"] = $field_type; 
    192192        if($field_type != "file") { 
    193             $options["value"] = array_key_exists("value", $options) 
     193            $options["value"] = array_key_exists("value", (array)$options) 
    194194                ? $options["value"] : $this->value(); 
    195195        } 
     
    198198                     $this->tag("input", $options), 
    199199                     @array_key_exists($this->attribute_name, 
    200                                       $this->object()->errors) 
     200                                      (array)$this->object()->errors) 
    201201                     ? true : false); 
    202202    } 
     
    226226     */ 
    227227    function to_text_area_tag($options = array()) { 
    228         if (array_key_exists("size", $options)) { 
     228        if (array_key_exists("size", (array)$options)) { 
    229229            $size = explode('x', $options["size"]); 
    230230            $options["cols"] = reset($size); 
     
    232232            unset($options["size"]); 
    233233        } 
    234         $options = array_merge($this->default_text_area_options, $options); 
     234        $options = array_merge($this->default_text_area_options, (array)$options); 
    235235        $options = $this->add_default_name_and_id($options); 
    236236        return $this->error_wrapping( 
     
    238238                              htmlspecialchars($this->value(), ENT_COMPAT), 
    239239                              $options), 
    240            array_key_exists($this->attribute_name,$this->object()->errors) 
     240           array_key_exists($this->attribute_name, (array)$this->object()->errors) 
    241241           ? $this->object()->errors[$this->attribute_name] : false); 
    242242    }