Skip to content

Commit acf7776

Browse files
authored
Markup - Added form_token() and form_submit() (#184)
1 parent a3496da commit acf7776

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

markup/functions/form.md

+28
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,34 @@ The above example would output as the following:
110110
</form>
111111
```
112112

113+
## form_token()
114+
115+
Outputs a `_token` hidden fields for CSRF protection.
116+
117+
```twig
118+
{{ form_token() }}
119+
```
120+
121+
The above example would output as the following:
122+
123+
```html
124+
<input name="_token" type="hidden" value="...">
125+
```
126+
127+
## form_submit()
128+
129+
Outputs an `input` element of type `submit`. This tag is generally available to provide consistency in usage.
130+
131+
```twig
132+
{{ form_submit() }}
133+
```
134+
135+
The above example would output as the following:
136+
137+
```html
138+
<input type="submit">
139+
```
140+
113141
## Passing attributes to the generated element
114142

115143
You can pass additional attributes to the `Form::open()` method by passing an array of attribute names and values to be rendered on the final generated `<form>` element.

0 commit comments

Comments
 (0)