Changeset 1543

Show
Ignore:
Timestamp:
12/15/07 17:07:27 (7 months ago)
Author:
PugFish
Message:

Added group support to Forge

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/modules/forge/libraries/Forge.php

    r1542 r1543  
    1212        ); 
    1313 
    14         protected $inputs = array(); 
    15         protected $hidden = array(); 
     14        public $inputs = array(); 
     15        public $hidden = array(); 
    1616 
    1717        public function __construct($action = '', $title = '', $method = NULL, $class = NULL) 
     
    5353                } 
    5454 
    55                 if ( ! ($input instanceof Form_Input)
     55                if ( ! ($input instanceof Form_Input) AND ! ($input instanceof Forge)
    5656                        throw new Kohana_Exception('forge.invalid_input', get_class($input)); 
    5757 
  • trunk/modules/forge/views/forge_template.php

    r1522 r1543  
    22<table class="<?php echo $class ?>"> 
    33<caption><?php echo $title ?></caption> 
    4 <?php foreach($inputs as $input): ?> 
     4<?php 
     5foreach($inputs as $input): 
     6 
     7$sub_inputs = array(); 
     8if ($input->type == 'group') 
     9
     10        $sub_inputs = $input->inputs; 
     11 
     12?> 
     13<tr> 
     14<th colspan="2"><?php echo $input->label() ?></th> 
     15</tr> 
     16<?php 
     17 
     18
     19else 
     20
     21        $sub_inputs = array($input);     
     22
     23 
     24foreach($sub_inputs as $input): 
     25 
     26?> 
    527<tr> 
    628<th><?php echo $input->label() ?></th> 
    729<td><?php echo $input->html() ?></td> 
    830</tr> 
    9 <?php endforeach; ?> 
     31<?php 
     32 
     33endforeach; 
     34 
     35endforeach; 
     36?> 
    1037</table> 
    1138<?php echo $close ?>