PHP Класс Frontend\Core\Engine\Form

Автор: Davy Hellemans ([email protected])
Автор: Tijs Verkoyen ([email protected])
Наследование: extends Common\Core\Form
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( string $name, string $action = null, string $method = 'post', string $hash = null, boolean $useToken = true )
addButton ( string $name, string $value, string $type = 'submit', string $class = null ) : SpoonFormButton Adds a button to the form
addDate ( string $name, mixed $value = null, string $type = null, integer $date = null, integer $date2 = null, string $class = null, string $classError = null ) : FrontendFormDate Adds a date field to the form
addFile ( string $name, string $class = null, string $classError = null ) : SpoonFormFile Adds a single file field.
addImage ( string $name, string $class = null, string $classError = null ) : FrontendFormImage Adds a single image field.
getTemplateExample ( ) : string Generates an example template, based on the elements already added.
getValues ( mixed $excluded = ['form', 'save', '_utf8'] ) : array Fetches all the values for this form as key/value pairs
parse ( TwigTemplate $tpl ) Parse the form

Описание методов

__construct() публичный Метод

public __construct ( string $name, string $action = null, string $method = 'post', string $hash = null, boolean $useToken = true )
$name string Name of the form.
$action string The action (URL) whereto the form will be submitted, if not provided it will be auto generated.
$method string The method to use when submitting the form, default is POST.
$hash string The id of the anchor to append to the action-URL.
$useToken boolean Should we automagically add a form token?

addButton() публичный Метод

Adds a button to the form
public addButton ( string $name, string $value, string $type = 'submit', string $class = null ) : SpoonFormButton
$name string Name of the button.
$value string The value (or label) that will be printed.
$type string The type of the button (submit is default).
$class string Class(es) that will be applied on the button.
Результат SpoonFormButton

addDate() публичный Метод

Adds a date field to the form
public addDate ( string $name, mixed $value = null, string $type = null, integer $date = null, integer $date2 = null, string $class = null, string $classError = null ) : FrontendFormDate
$name string Name of the element.
$value mixed The value for the element.
$type string The type (from, till, range) of the datepicker.
$date integer The date to use.
$date2 integer The second date for a rangepicker.
$class string Class(es) that have to be applied on the element.
$classError string Class(es) that have to be applied when an error occurs on the element.
Результат FrontendFormDate

addFile() публичный Метод

Adds a single file field.
public addFile ( string $name, string $class = null, string $classError = null ) : SpoonFormFile
$name string Name of the element.
$class string Class(es) that will be applied on the element.
$classError string Class(es) that will be applied on the element when an error occurs.
Результат SpoonFormFile

addImage() публичный Метод

Adds a single image field.
public addImage ( string $name, string $class = null, string $classError = null ) : FrontendFormImage
$name string The name of the element.
$class string Class(es) that will be applied on the element.
$classError string Class(es) that will be applied on the element when an error occurs.
Результат FrontendFormImage

getTemplateExample() публичный Метод

Generates an example template, based on the elements already added.
public getTemplateExample ( ) : string
Результат string

getValues() публичный Метод

Fetches all the values for this form as key/value pairs
public getValues ( mixed $excluded = ['form', 'save', '_utf8'] ) : array
$excluded mixed Which elements should be excluded?
Результат array

parse() публичный Метод

Parse the form
public parse ( TwigTemplate $tpl )
$tpl TwigTemplate The template instance wherein the form will be parsed.