Пример #1
0
 /**
  * Set up a Field instance
  *
  * @param string $type A field type
  */
 public function __construct($type, $name, $label, $value, $attributes)
 {
     // Set base parameters
     $this->attributes = (array) $attributes;
     $this->label = $label;
     $this->name = $name;
     $this->type = $type;
     $this->value = $value;
     // Set magic parameters (repopulated value, translated label, etc)
     if (Config::get('automatic_label')) {
         $this->ponder($name, $label);
     }
     if ($type != 'password') {
         $this->value = $this->repopulate();
     }
     if (Config::get('live_validation')) {
         $this->addRules();
     }
     // Link Control group
     if (Framework::isnt(null)) {
         $this->controlGroup = new ControlGroup($this->label);
     }
 }