Skip to content

Commit

Permalink
Merge branch '5.x' into ref/forward-as-cli-command
Browse files Browse the repository at this point in the history
  • Loading branch information
theus77 authored Dec 11, 2024
2 parents c59d7b9 + 72f180f commit 654597d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions EMS/common-bundle/src/Twig/CommonExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public function getFilters(): array
new TwigFilter('ems_valid_mail', [TextRuntime::class, 'isValidEmail']),
new TwigFilter('ems_uuid', [UuidGenerator::class, 'fromValue']),
new TwigFilter('ems_date', DateTime::createFromFormat(...)),
new TwigFilter('ems_int', intval(...)),
];
}

Expand Down
8 changes: 8 additions & 0 deletions docs/dev/common-bundle/twig.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* [ems_valid_mail](#ems_valid_mail)
* [ems_uuid](#ems_uuid-1)
* [ems_date](#ems_date)
* [ems_int](#ems_int)
<!-- TOC -->

# Twig Functions
Expand Down Expand Up @@ -433,3 +434,10 @@ Generate a \DateTimeImmutable object from a value.
{{ date.timezone }}
```

## ems_int

Use php \intval function on input

```twig
{% set size = app.request.query.get('size', 0)|ems_int %}
```

0 comments on commit 654597d

Please sign in to comment.