Theme assets
filter
Resolves a theme asset to a URL: a full URL is returned unchanged, then the dev server is used when
THEME_ASSETS_SERVER is set, then the Vite manifest, then /e/{theme}/assets/....filter
Resolves an application asset through the app’s own build manifest. Themes rarely need it; use
asset_url for your own files.Translation
All nine gettext helpers are available as both functions and filters. Themes use thetheme domain, so reach for the d-prefixed variants.
Other functions
function
hash_hmac(algo, data, key). Used for identity verification in support widgets. It runs server-side, so the secret stays out of the page.function
locale_script(code) returns the URL of the browser translation catalog for a language, or null. Include it when your JavaScript needs translated strings.function
template(string, name = null, strict = false) compiles a string into a template. It’s how administrator-supplied markup is rendered; strict variables are disabled, and unparsable input falls back to being printed verbatim.Tests
test
True when an object’s class is marked as built into the application, which the admin templates use to distinguish bundled integrations from plugin-provided ones.
Extensions inherited from Twig
Globals
See Template objects for the full shape of each object.
Namespaces
Strict variables
WithDEBUG=true, Twig raises an error for undefined variables. Guard optional values with is defined or |default(...), and test your theme in debug mode before release.