Creates a form label. Label text is not automatically translated.
echo Form::label('username', 'Username');
string Core_Form::label( string $input [, string $text = null , array $attributes = null ] )
参数列表
参数 类型 描述 默认值 $inputstringTarget input $textstringLabel text null $attributesarrayHtml attributes null
string public static function label($input, $text = null, array $attributes = null)
{
if ($text === null)
{
// Use the input name as the text
$text = ucwords(preg_replace('/\W+/', ' ', $input));
}
// Set the label target
$attributes['for'] = $input;
return '<label' . HTML::attributes($attributes) . '>' . $text . '</label>';
}