예제 #1
0
 /**
  * __construct
  *
  * @param mixed   $caption Caption or array of all attributes
  *                          Control attributes:
  *                              :inline true to render with inline style
  * @param string  $name    name attribute
  * @param string  $value   Pre-selected value
  * @param boolean $inline  true to display inline
  */
 public function __construct($caption, $name = null, $value = null, $inline = true)
 {
     if (is_array($caption)) {
         parent::__construct($caption);
     } else {
         parent::__construct([]);
         $this->setWithDefaults('caption', $caption, '');
         $this->setWithDefaults('name', $name, 'name_error');
         $this->set('value', $value);
         if ($inline) {
             $this->set(':inline');
         }
     }
     $this->set('type', 'radio');
 }
예제 #2
0
 /**
  * Constructor
  *
  * @param string|array $caption  Caption or array of all attributes
  * @param string       $name     name" attribute
  * @param mixed        $value    Pre-selected value (or array of them).
  * @param integer      $size     Number or rows. "1" makes a drop-down-list
  * @param boolean      $multiple Allow multiple selections?
  */
 public function __construct($caption, $name = null, $value = null, $size = 1, $multiple = false)
 {
     if (is_array($caption)) {
         parent::__construct($caption);
         $this->setIfNotSet('size', 1);
     } else {
         $this->setWithDefaults('caption', $caption, '');
         $this->setWithDefaults('name', $name, 'name_error');
         $this->set('value', $value);
         $this->setWithDefaults('size', $size, 1);
         if ($multiple) {
             $this->set('multiple');
         }
     }
 }