Skip to content

Commit

Permalink
Markup - Added form_token() and form_submit() (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
WebVPF authored Apr 3, 2024
1 parent a3496da commit acf7776
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions markup/functions/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,34 @@ The above example would output as the following:
</form>
```

## form_token()

Outputs a `_token` hidden fields for CSRF protection.

```twig
{{ form_token() }}
```

The above example would output as the following:

```html
<input name="_token" type="hidden" value="...">
```

## form_submit()

Outputs an `input` element of type `submit`. This tag is generally available to provide consistency in usage.

```twig
{{ form_submit() }}
```

The above example would output as the following:

```html
<input type="submit">
```

## Passing attributes to the generated element

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.
Expand Down

0 comments on commit acf7776

Please sign in to comment.