LabelWidget
in package
implements
WidgetInterface
Form 'widget' for creating labels.
Generally this element is used by other widgets, and FormHelper itself.
Table of Contents
Interfaces
- WidgetInterface
- Interface for input widgets.
Properties
- $_labelTemplate : string
- The template to use.
- $_templates : StringTemplate
- Templates
Methods
- __construct() : mixed
- Constructor.
- render() : string
- Render a label widget.
- secureFields() : array<string|int, string>
- Returns a list of fields that need to be secured for this widget.
Properties
$_labelTemplate
The template to use.
protected
string
$_labelTemplate
= 'label'
$_templates
Templates
protected
StringTemplate
$_templates
Methods
__construct()
Constructor.
public
__construct(StringTemplate $templates) : mixed
This class uses the following template:
-
label
Used to generate the label for a radio button. Can use the following variablesattrs
,text
andinput
.
Parameters
- $templates : StringTemplate
-
Templates list.
render()
Render a label widget.
public
render(array<string, mixed> $data, ContextInterface $context) : string
Accepts the following keys in $data:
-
text
The text for the label. -
input
The input that can be formatted into the label if the template allows it. -
escape
Set to false to disable HTML escaping.
All other attributes will be converted into HTML attributes.
Parameters
- $data : array<string, mixed>
-
Data array.
- $context : ContextInterface
-
The current form context.
Return values
stringsecureFields()
Returns a list of fields that need to be secured for this widget.
public
secureFields(array<string|int, mixed> $data) : array<string|int, string>
Parameters
- $data : array<string|int, mixed>
-
The data to render.
Tags
Return values
array<string|int, string> —Array of fields to secure.