Theme Filters
This document lists all the custom Twig filters available for theme development in SitePack. These filters are exposed via the ThemeService and can be used within theme templates.
Filters
asset_url
Alias for theme_asset(). Can be used as a filter on a string path.
- Example:
<img src="{{ 'images/logo.png'|asset_url }}">
ensure_link
Ensures a string is a valid URL path (e.g., prepends / if missing and it's not an absolute URL).
- Example:
<a href="{{ my_path|ensure_link }}">Link</a>
hex_to_rgb
Converts a hex color code to a comma-separated RGB string.
- Example:
<div style="background-color: rgba({{ '#ffffff'|hex_to_rgb }}, 0.5)">...</div>