FancyFileWidget
in package
implements
WidgetInterface
Form 'widget' for creating fancy file widgets made of a button and a text input.
Generally this element is used by other widgets, and FormHelper itself.
Table of Contents
Interfaces
- WidgetInterface
Properties
- $_button : ButtonWidget
- ButtonWidget instance.
- $_file : FileWidget
- FileWidget instance.
- $_input : BasicWidget
- Text widget instance.
- $_templates : StringTemplate
- Templates
Methods
- __construct() : mixed
- Constructor
- render() : string
- Render a custom file upload form widget.
- secureFields() : array<string|int, mixed>
- {@inheritDoc}
- _fakeFieldName() : string
- Determine name of fake input field
Properties
$_button
ButtonWidget instance.
protected
ButtonWidget
$_button
$_file
FileWidget instance.
protected
FileWidget
$_file
$_input
Text widget instance.
protected
BasicWidget
$_input
$_templates
Templates
protected
StringTemplate
$_templates
Methods
__construct()
Constructor
public
__construct(StringTemplate $templates, FileWidget $file, ButtonWidget $button, BasicWidget $input) : mixed
Parameters
- $templates : StringTemplate
-
Templates list.
- $file : FileWidget
-
A file widget.
- $button : ButtonWidget
-
A button widget.
- $input : BasicWidget
-
A text input widget.
render()
Render a custom file upload form widget.
public
render(array<string|int, mixed> $data, ContextInterface $context) : string
Data supports the following keys:
_input- Options for the input element._button- Options for the button element.name- Set the input name.count-label- Label for multiple files. Default is__('files selected').button-label- Button text. Default is__('Choose File').escape- Set to false to disable HTML escaping.
All other keys will be converted into HTML attributes.
Unlike other input objects the val property will be specifically
ignored.
Parameters
- $data : array<string|int, mixed>
-
The data to build a file input with.
- $context : ContextInterface
-
The current form context.
Return values
string —HTML elements.
secureFields()
{@inheritDoc}
public
secureFields(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
Return values
array<string|int, mixed>_fakeFieldName()
Determine name of fake input field
protected
static _fakeFieldName(string $fieldName) : string
Parameters
- $fieldName : string
-
original field name
Return values
string —fake field name