Example #1
0
 /**
  * Create new instance.
  *
  * @param string $field
  * @param string $value (optional)
  * @param bool $required (optional)
  * @param string $class (optional)
  */
 public function __construct($field, $value = "1", $required = false, $class = '')
 {
     parent::__construct('checkbox', $field, $required);
     $this->addAttribute('value', $value);
     if (!empty($class)) {
         $this->appendAttribute('class', $class);
     }
 }
Example #2
0
 /**
  * Create new instance.
  *
  * @param string $field
  * @param bool $required (optional)
  * @param int $maxlength (optional)
  */
 public function __construct($field, $required = true, $maxlength = 255)
 {
     parent::__construct('file', $field, $required);
     $this->addAttribute('maxlength', $maxlength);
     $this->appendAttribute('class', 'long');
     if (strpos($field, '[]') > 0) {
         $this->addAttribute('multiple', 'multiple');
     }
 }
Example #3
0
 /**
  * Create new instance.
  *
  * @param string $value
  * @param string $key (optional)
  * @param bool $selected (optional)
  */
 public function __construct($field, $id, $value, $selected)
 {
     parent::__construct('radio', $field, false);
     $this->addAttribute('id', $id);
     $this->setValue($value);
     if ($selected) {
         $this->addAttribute('checked', 'checked');
     }
     $this->resetValueBeforeRender = false;
 }
Example #4
0
 /**
  * Create new instance.
  *
  * @param $field
  * @param bool $required (optional)
  * @param int $maxlength (optional)
  * @param string $class (optional)
  */
 public function __construct($field, $required = true, $maxlength = 255, $class = '')
 {
     parent::__construct('url', $field, $required);
     $this->addAttribute('maxlength', $maxlength);
     $this->appendAttribute('class', $class);
 }
Example #5
0
 /**
  * @param $field
  * @param bool $required
  * @param int $maxlength
  */
 public function __construct($field, $required = true, $maxlength = 255)
 {
     parent::__construct('text', $field, $required);
     $this->addAttribute('maxlength', $maxlength);
     $this->appendAttribute('class', 'username-suggest');
 }
Example #6
0
 /**
  * Create new instance.
  *
  * @param string $field
  * @param bool $required (optional)
  */
 public function __construct($field, $required = true)
 {
     parent::__construct('text', $field, $required);
     $this->addAttribute('maxlength', '10');
     $this->appendAttribute('class', 'date');
 }