Extension
in package
implements
ExtensionInterface
Twig extension providing usefull functions for working with forms
Table of Contents
Interfaces
- ExtensionInterface
Methods
- getFilters() : array<string|int, TwigFilter>
- Returns a list of filters to add to the existing list.
- getFunctions() : array<string|int, TwigFunction>
- Returns a list of functions to add to the existing list.
- getNodeVisitors() : array<string|int, NodeVisitorInterface>
- Returns the node visitor instances to add to the existing list.
- getOperators() : array<string|int, array<string|int, mixed>>
- Returns a list of operators to add to the existing list.
- getTests() : array<string|int, TwigTest>
- Returns a list of tests to add to the existing list.
- getTokenParsers() : array<string|int, TokenParserInterface>
- Returns the token parser instances to add to the existing list.
Methods
getFilters()
Returns a list of filters to add to the existing list.
public
getFilters() : array<string|int, TwigFilter>
Not used until now ...
Return values
array<string|int, TwigFilter>getFunctions()
Returns a list of functions to add to the existing list.
public
getFunctions() : array<string|int, TwigFunction>
Return values
array<string|int, TwigFunction> —Twig function form_open
Twig function to open an HTML form by a provisioned <form> tag.
Usage:
{{ form_open( attributes ) }}
The parameter attributes is a dictionary (key-value-list) for
provisioning the <form> tag.
Key-names can be all valid attribute names of the <form> tag,
see w3schools.com.
Some specials do exist:
-
methoddefaults toPOST; if notGETorPOST, an additional_methodinput ofhiddentype will be added. - You can add the additional attribute
token, if you want to add a hidden input with the name_tokene.g. to use your CSRF token within the form. - If no
enctypeattribute is given, this extension usesmultipart/form-databy default. - Since this extension is part of TwigForm, which uses
Bootstrap (version 5) for styling, our form
classattribute defaults toform-horizontal– please adjust for your needs. - You can also add only additional classes without
overriding the already mentioned
classattribute by usingadd_classattribute – it takes one string to be appended to the actualclassattribute
Twig function form_close
Twig function that returns a </form> tag;
closing of form_open function.
Usage:
{{ form_close() }}
Twig function request_data
Twig function that returns a value out of the default global
$_REQUEST, $_GET or $_POST variables.
Usage:
{{ request_data( name [, default [, method ]] ) }}
-
nameis the string value of the name to be looked for -
default(optional) is a default value to be returned, if variable does not exist -
method(optional) represents the specific method to be looked into –GET,POSTorREQUEST. If no value given, the function defaults it toNULLand then will use$_REQUESTfor lookup.
getNodeVisitors()
Returns the node visitor instances to add to the existing list.
public
getNodeVisitors() : array<string|int, NodeVisitorInterface>
Not used until now ...
Return values
array<string|int, NodeVisitorInterface>getOperators()
Returns a list of operators to add to the existing list.
public
getOperators() : array<string|int, array<string|int, mixed>>
Not used until now ...
Return values
array<string|int, array<string|int, mixed>> —First array of unary operators, second array of binary operators
getTests()
Returns a list of tests to add to the existing list.
public
getTests() : array<string|int, TwigTest>
Not used until now ...
Return values
array<string|int, TwigTest>getTokenParsers()
Returns the token parser instances to add to the existing list.
public
getTokenParsers() : array<string|int, TokenParserInterface>
Not used until now ...