summaryrefslogtreecommitdiff
path: root/core/libraries/MY_Forge.php
blob: 0aedac8639b38242fbbb9b69544dbe6bed7788fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
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]);
      }
    }
  }
}