Fr3nch13/CakePHP Utilities

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

Methods

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
string

secureFields()

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
inheritDoc
Return values
array<string|int, string>

Array of fields to secure.


        
On this page

Search results