Changeset 3255
- Timestamp:
- 08/04/2008 08:25:55 PM (4 months ago)
- Files:
-
- 1 modified
-
tags/2.1.3/modules/forge/libraries/Forge.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/2.1.3/modules/forge/libraries/Forge.php
r2702 r3255 37 37 * @return void 38 38 */ 39 public function __construct($action = '', $title = '', $method = NULL, $attr = array())39 public function __construct($action = NULL, $title = '', $method = NULL, $attr = array()) 40 40 { 41 41 // Set form attributes … … 88 88 89 89 // Create the input 90 switch (count($args))90 switch (count($args)) 91 91 { 92 92 case 1: … … 157 157 { 158 158 $status = TRUE; 159 foreach($this->inputs as $input) 159 160 $inputs = array_merge($this->hidden, $this->inputs); 161 162 foreach ($inputs as $input) 160 163 { 161 164 if ($input->validate() == FALSE) … … 176 179 { 177 180 $data = array(); 178 foreach(array_merge($this->hidden, $this->inputs) as $input) 179 { 180 if ($name = $input->name) 181 foreach (array_merge($this->hidden, $this->inputs) as $input) 182 { 183 if (is_object($input->name)) // It's a Forge_Group object (hopefully) 184 { 185 foreach ($input->inputs as $group_input) 186 { 187 if ($name = $group_input->name) 188 { 189 $data[$name] = $group_input->value; 190 } 191 } 192 } 193 else if (is_array($input->inputs)) 194 { 195 foreach ($input->inputs as $group_input) 196 { 197 if ($name = $group_input->name) 198 { 199 $data[$name] = $group_input->value; 200 } 201 } 202 } 203 else if ($name = $input->name) // It's a normal input 181 204 { 182 205 // Return only named inputs … … 210 233 * @return string 211 234 */ 212 public function html($template = 'forge_template', $custom = FALSE)235 public function render($template = 'forge_template', $custom = FALSE) 213 236 { 214 237 // Load template … … 233 256 if (is_array($errors) AND ! empty($errors)) 234 257 { 235 foreach ($errors as $error)258 foreach ($errors as $error) 236 259 { 237 260 // Replace the message with the error in the html error string … … 253 276 if ( ! empty($this->hidden)) 254 277 { 255 foreach ($this->hidden as $input)278 foreach ($this->hidden as $input) 256 279 { 257 280 $hidden[$input->name] = $input->value; … … 285 308 public function __toString() 286 309 { 287 return $this->html();310 return (string) $this->render(); 288 311 } 289 312
