public static function select($name, array $options = NULL, $selected = NULL, array $attributes = NULL) { if (!isset($attributes['id']) and self::$auto_id) { $attributes['id'] = 'field-' . $name; } return parent::select($name, $options, $selected, $attributes) . PHP_EOL; }
public static function select($name, array $options = NULL, $selected = NULL, array $attributes = NULL) { if (static::$model) { if (isset(static::$model->table_columns()[$name])) { $selected = static::$model->{$name}; $attributes['id'] = static::$model_name . '_' . URL::title($name); $name = static::$model_name . '[' . $name . ']'; } } return parent::select($name, $options, $selected, $attributes); }
/** * Creates a select form input. * * @param string input name * @param array available options * @param string selected option * @param array html attributes * @return string */ public function select($name, array $options = NULL, $selected = NULL, array $attributes = NULL) { $this->load_values($name, $selected, $attributes); return '<li>' . Kohana_Form::select($name, $options, $selected, $attributes) . $this->addAlertSpan(isset($this->errors[$name]) ? $this->errors[$name] : NULL, $attributes) . '</li>'; }
/** * Creates a select form input. * * @param string input name * @param array available options * @param string selected option * @param array html attributes * @return string */ public function select($name, array $options = NULL, $selected = NULL, array $attributes = NULL) { $this->load_values($name, $selected, $attributes); $result = '<li>' . Kohana_Form::select($name, $options, $selected, $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; }