label() public static method
Generates a label tag.
public static string label ( $content, $for = null, $options = [] ) | ||
---|---|---|
$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 |
Please login to continue.