diff options
Diffstat (limited to 'core/libraries')
| -rw-r--r-- | core/libraries/MY_Forge.php | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/core/libraries/MY_Forge.php b/core/libraries/MY_Forge.php index a954eb9e..0aedac86 100644 --- a/core/libraries/MY_Forge.php +++ b/core/libraries/MY_Forge.php @@ -3,4 +3,18 @@ class Forge extends Forge_Core {    public function render($template="form.html", $custom=false) {      return parent::render($template, $custom);    } + +  /** +   * Associate validation rules defined in the model with this form. +   */ +  public function add_rules_from($model) { +    foreach ($this->inputs as $name => $input) { +      if (isset($input->inputs)) { +        $input->add_rules_from($model); +      } +      if (isset($model->rules[$name])) { +        $input->rules($model->rules[$name]); +      } +    } +  }  }
\ No newline at end of file | 
