Changeset 3255 for tags

Show
Ignore:
Timestamp:
08/04/2008 08:25:55 PM (4 months ago)
Author:
Shadowhand
Message:

Merged r3254 into tags/2.1.3

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tags/2.1.3/modules/forge/libraries/Forge.php

    r2702 r3255  
    3737         * @return  void 
    3838         */ 
    39         public function __construct($action = '', $title = '', $method = NULL, $attr = array()) 
     39        public function __construct($action = NULL, $title = '', $method = NULL, $attr = array()) 
    4040        { 
    4141                // Set form attributes 
     
    8888 
    8989                // Create the input 
    90                 switch(count($args)) 
     90                switch (count($args)) 
    9191                { 
    9292                        case 1: 
     
    157157        { 
    158158                $status = TRUE; 
    159                 foreach($this->inputs as $input) 
     159 
     160                $inputs = array_merge($this->hidden, $this->inputs); 
     161 
     162                foreach ($inputs as $input) 
    160163                { 
    161164                        if ($input->validate() == FALSE) 
     
    176179        { 
    177180                $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 
    181204                        { 
    182205                                // Return only named inputs 
     
    210233         * @return  string 
    211234         */ 
    212         public function html($template = 'forge_template', $custom = FALSE) 
     235        public function render($template = 'forge_template', $custom = FALSE) 
    213236        { 
    214237                // Load template 
     
    233256                                if (is_array($errors) AND ! empty($errors)) 
    234257                                { 
    235                                         foreach($errors as $error) 
     258                                        foreach ($errors as $error) 
    236259                                        { 
    237260                                                // Replace the message with the error in the html error string 
     
    253276                        if ( ! empty($this->hidden)) 
    254277                        { 
    255                                 foreach($this->hidden as $input) 
     278                                foreach ($this->hidden as $input) 
    256279                                { 
    257280                                        $hidden[$input->name] = $input->value; 
     
    285308        public function __toString() 
    286309        { 
    287                 return $this->html(); 
     310                return (string) $this->render(); 
    288311        } 
    289312