- Timestamp:
- 03/19/09 10:40:34 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/action_view/helpers/form_helper.php
r243 r308 131 131 */ 132 132 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)) { 135 135 $options['name'] = $name_option_exists 136 136 ? $options['name'] 137 137 : $this->tag_name_with_index($options['index']); 138 $options['id'] = array_key_exists('id', $options)138 $options['id'] = array_key_exists('id', (array)$options) 139 139 ? $options['id'] 140 140 : $this->tag_id_with_index($options['index']); … … 144 144 ? $options['name'] 145 145 : $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) 147 147 ? $options['id'] 148 148 : $this->tag_id_with_index($this->auto_index); … … 151 151 ? $options['name'] 152 152 : $this->tag_name(); 153 $options['id'] = array_key_exists('id', $options)153 $options['id'] = array_key_exists('id', (array)$options) 154 154 ? $options['id'] 155 155 : $this->tag_id(); 156 156 } 157 if(array_key_exists('multiple', $options) && !$name_option_exists) {157 if(array_key_exists('multiple', (array)$options) && !$name_option_exists) { 158 158 $options['name'] .= "[]"; 159 159 } … … 181 181 */ 182 182 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) 184 184 ? $options["maxlength"] : $this->default_field_options['size']; 185 $options["size"] = array_key_exists("size", $options)185 $options["size"] = array_key_exists("size", (array)$options) 186 186 ? $options["size"]: $default_size; 187 $options = array_merge($this->default_field_options, $options);187 $options = array_merge($this->default_field_options, (array)$options); 188 188 if($field_type == "hidden") { 189 189 unset($options["size"]); … … 191 191 $options["type"] = $field_type; 192 192 if($field_type != "file") { 193 $options["value"] = array_key_exists("value", $options)193 $options["value"] = array_key_exists("value", (array)$options) 194 194 ? $options["value"] : $this->value(); 195 195 } … … 198 198 $this->tag("input", $options), 199 199 @array_key_exists($this->attribute_name, 200 $this->object()->errors)200 (array)$this->object()->errors) 201 201 ? true : false); 202 202 } … … 226 226 */ 227 227 function to_text_area_tag($options = array()) { 228 if (array_key_exists("size", $options)) {228 if (array_key_exists("size", (array)$options)) { 229 229 $size = explode('x', $options["size"]); 230 230 $options["cols"] = reset($size); … … 232 232 unset($options["size"]); 233 233 } 234 $options = array_merge($this->default_text_area_options, $options);234 $options = array_merge($this->default_text_area_options, (array)$options); 235 235 $options = $this->add_default_name_and_id($options); 236 236 return $this->error_wrapping( … … 238 238 htmlspecialchars($this->value(), ENT_COMPAT), 239 239 $options), 240 array_key_exists($this->attribute_name, $this->object()->errors)240 array_key_exists($this->attribute_name, (array)$this->object()->errors) 241 241 ? $this->object()->errors[$this->attribute_name] : false); 242 242 }
