Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Twig Tools

Security covered Under active development 4,053 sites

Part of the Twig ecosystem · 43 projects

The Twig Tools module enhances Drupal's Twig templating system by adding a variety of new filters. These filters provide helpful tools for sanitizing arrays, converting data types (like booleans, integers, and floats), encoding/decoding data, and manipulating color values between different formats.

The Twig Tools module provides additional Twig filters and functions.

Current Filters:

Sanitization Filters:

clean_class_array
Sanitizes all strings in an array for use as valid class names.
array_unique
Filters all non-unique values from an array.
remove_empty
Removes all falsy values from an array.
scrub_class_array
Runs an array through all three Twig Tools sanitization filters.

Conversion Filters:

boolean
Returns the boolean value of a passed variable.
integer
Returns the integer value of a passed variable.
float
Returns the float value of a passed variable.
string
Returns the string value of a passed variable.
md5
Returns the md5 hash value of a passed variable.
json_decode
Decodes a JSON string into an object or array.
date_from_format
Converts a datetime string between two specified formats.
base64_encode
Encodes a base64 string.
base64_decode
Decodes a base64 string.

Color Filters:

rgb_to_hex
Returns the hexadecimal color value of an RGB array of values.
css_rgb_to_hex
Returns the hexadecimal color value of a passed CSS RGB color string.
hex_to_rgb
Returns an array of equivalent RGB values of the passed hexadecimal color.
hex_to_css_rgb
Returns the CSS RGB string equivalent of the passed hexadecimal color.
Drupal 9–11

Ask your assistant about Twig Tools

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
2
Tracked since
Jan 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Active

Releases

Version Type Core PHP Release date
2.1.0 Stable 9–11 Sep 23, 2024
2.0.0 Stable 9–10 Jan 18, 2023