Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Twig Extensions

330 sites Security covered Drupal 10–11 Twig ecosystem
View on drupal.org

This module adds useful custom features to Twig templates. It offers functions for shuffling arrays, converting dates into "time ago" formats, and localizing numbers, currencies, and dates. Additionally, it provides tools for truncating text and wrapping words.

This module provides common additional features for Twig that do not directly belong in core. It used to include these through the twig/extensions package, but since that has been abandoned the extensions have been included in the module itself.

Filters

Extension name Description shuffle Shuffles an array. time_diff Converts dates to a time ago string like Facebook and Twitter has. localizeddate Formats dates using \IntlDateFormatter. localizednumber Formats numbers using \IntlDateFormatter. localizedcurrency Formats currencies using \IntlDateFormatter. truncate Truncates text to a certain length, optionally preserving words. wordwrap Wraps a string into new lines when it reaches a specific length.

Similar projects

  • Twig IntlExtension: provides alternatives to the localized* filters. Uses the twigphp/intl-extra package, but breaks the core format_date filter
  • Time diff: provides a time_diff filter, but isn't as flexible as the original Twig filter

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Nov 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 4
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
8.x-2.5 Stable 10–11 Jun 11, 2025
8.x-2.4 Stable 10–11 May 19, 2025
8.x-2.3 Stable 10–11 Mar 4, 2025
8.x-2.2 Stable 10–11 Nov 28, 2024