Пример #1
0
 public static function radio($name, $value = NULL, $checked = FALSE, array $attributes = NULL)
 {
     if (!isset($attributes['id']) and self::$auto_id) {
         $attributes['id'] = 'field-' . $name . '-' . url::title($value);
     }
     return parent::radio($name, $value, $checked, $attributes) . PHP_EOL;
 }
Пример #2
0
 /**
  * Creates a radio form input.
  * @param string $name
  * @param null $value
  * @param bool $checked
  * @param array $attributes
  * @return string
  */
 public static function radio($name, $value = null, $checked = false, array $attributes = null)
 {
     if (isset($attributes['uncheck'])) {
         // Add a hidden field so that if the radio button is not selected, it still submits a value
         $hidden = Form::hidden($name, $attributes['uncheck']);
         unset($attributes['uncheck']);
     } else {
         $hidden = '';
     }
     return $hidden . parent::radio($name, $value, $checked, $attributes);
 }
Пример #3
0
 /**
  * Creates a radio form input.
  *
  * @param   string   input name
  * @param   string   input value
  * @param   boolean  checked status
  * @param   array    html attributes
  * @return  string
  */
 public function radio($name, $value = NULL, $checked = FALSE, array $attributes = NULL)
 {
     $this->load_values($name, $value, $attributes);
     return '<li>' . Kohana_Form::radio($name, $value, $checked, $attributes) . $this->addAlertSpan(isset($this->errors[$name]) ? $this->errors[$name] : NULL, $attributes) . '</li>';
 }
Пример #4
0
 /**
  * Creates a radio form input.
  *
  * @param   string   input name
  * @param   string   input value
  * @param   boolean  checked status
  * @param   array    html attributes
  * @return  string
  */
 public function radio($name, $value = NULL, $checked = FALSE, array $attributes = NULL)
 {
     $this->load_values($name, $value, $attributes);
     $result = '<li>' . Kohana_Form::radio($name, $value, $checked, $attributes);
     // add error span
     if (isset($this->errors[$name])) {
         $result .= '<span class="' . $this->error_class . '">' . ucfirst($this->errors[$name]) . '</span>';
     } else {
         if (isset($attributes['info'])) {
             // else add info span
             $result .= '<span class="' . $this->info_class . '">' . $attributes['info'] . '</span>';
         }
     }
     $result .= '</li>';
     return $result;
 }