Generates a label tag.
public static label ( string $content, string $for = null, array $options = [] ) : string | ||
$content | string | label text. It will NOT be HTML-encoded. Therefore you can pass in HTML code such as an image tag. If this is is coming from end users, you should [[encode()]] it to prevent XSS attacks. |
$for | string | the ID of the HTML element that this label is associated with. If this is null, the "for" attribute will not be generated. |
$options | array | the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. See [[renderTagAttributes()]] for details on how attributes are being rendered. |
return | string | the generated label tag |