Fr3nch13/CakePHP Utilities

YearWidget extends BasicWidget
in package

Input widget class for generating a calendar year select box.

This class is usually used internally by Cake\View\Helper\FormHelper, it but can be used to generate standalone calendar year select boxes.

Table of Contents

Properties

$_select  : SelectBoxWidget
Select box widget.
$_templates  : StringTemplate
StringTemplate instance.
$defaults  : array<string, mixed>
Data defaults.

Methods

__construct()  : mixed
Constructor
render()  : string
Renders a year select box.
secureFields()  : array<string|int, string>
Returns a list of fields that need to be secured for this widget.
mergeDefaults()  : array<string, mixed>
Merge default values with supplied data.
setMaxLength()  : array<string, mixed>
Set value for "maxlength" attribute if applicable.
setRequired()  : array<string, mixed>
Set value for "required" attribute if applicable.
setStep()  : array<string, mixed>
Set value for "step" attribute if applicable.

Properties

$defaults

Data defaults.

protected array<string, mixed> $defaults = ['name' => '', 'val' => null, 'min' => null, 'max' => null, 'order' => 'desc', 'templateVars' => []]

Methods

render()

Renders a year select box.

public render(array<string, mixed> $data, ContextInterface $context) : string
Parameters
$data : array<string, mixed>

Data to render with.

$context : ContextInterface

The current form context.

Return values
string

A generated select box.

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.

mergeDefaults()

Merge default values with supplied data.

protected mergeDefaults(array<string, mixed> $data, ContextInterface $context) : array<string, mixed>
Parameters
$data : array<string, mixed>

Data array

$context : ContextInterface

Context instance.

Return values
array<string, mixed>

Updated data array.

setMaxLength()

Set value for "maxlength" attribute if applicable.

protected setMaxLength(array<string, mixed> $data, ContextInterface $context, string $fieldName) : array<string, mixed>
Parameters
$data : array<string, mixed>

Data array

$context : ContextInterface

Context instance.

$fieldName : string

Field name.

Return values
array<string, mixed>

Updated data array.

setRequired()

Set value for "required" attribute if applicable.

protected setRequired(array<string, mixed> $data, ContextInterface $context, string $fieldName) : array<string, mixed>
Parameters
$data : array<string, mixed>

Data array

$context : ContextInterface

Context instance.

$fieldName : string

Field name.

Return values
array<string, mixed>

Updated data array.

setStep()

Set value for "step" attribute if applicable.

protected setStep(array<string, mixed> $data, ContextInterface $context, string $fieldName) : array<string, mixed>
Parameters
$data : array<string, mixed>

Data array

$context : ContextInterface

Context instance.

$fieldName : string

Field name.

Return values
array<string, mixed>

Updated data array.


        
On this page

Search results