ButtonWidget
in package
implements
WidgetInterface
Button input class
This input class can be used to render button elements. If you need to make basic submit inputs with type=submit, use the Basic input widget.
Table of Contents
Interfaces
- WidgetInterface
- Interface for input widgets.
Properties
- $_templates : StringTemplate
- StringTemplate instance.
Methods
- __construct() : mixed
- Constructor.
- render() : string
- Render a button.
- secureFields() : array<string|int, string>
- Returns a list of fields that need to be secured for this widget.
Properties
$_templates
StringTemplate instance.
protected
StringTemplate
$_templates
Methods
__construct()
Constructor.
public
__construct(StringTemplate $templates) : mixed
Parameters
- $templates : StringTemplate
-
Templates list.
render()
Render a button.
public
render(array<string, mixed> $data, ContextInterface $context) : string
This method accepts a number of keys:
-
text
The text of the button. Unlike all other form controls, buttons do not escape their contents by default. -
escapeTitle
Set to false to disable escaping of button text. -
escape
Set to false to disable escaping of attributes. -
type
The button type defaults to 'submit'.
Any other keys provided in $data will be converted into HTML attributes.
Parameters
- $data : array<string, mixed>
-
The data to build a button with.
- $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.