/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/View/Widget
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/cakephp/src/View/Widget/ButtonWidget.php (2777B)
_templates = $templates;
}
/**
* Render a button.
*
* 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.
*
* @param array
$data The data to build a button with.
* @param \Cake\View\Form\ContextInterface $context The current form context.
* @return string
*/
public function render(array $data, ContextInterface $context): string
{
$data += [
'text' => '',
'type' => 'submit',
'escapeTitle' => true,
'escape' => true,
'templateVars' => [],
];
return $this->_templates->format('button', [
'text' => $data['escapeTitle'] ? h($data['text']) : $data['text'],
'templateVars' => $data['templateVars'],
'attrs' => $this->_templates->formatAttributes($data, ['text', 'escapeTitle']),
]);
}
/**
* @inheritDoc
*/
public function secureFields(array $data): array
{
if (!isset($data['name']) || $data['name'] === '') {
return [];
}
return [$data['name']];
}
}