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.
Project information
- Project categories: Content display, Developer tools
3,787 sites report using this module
- Created by pcate on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
