Appearance
Templating
Themes render with Twig. Beyond standard Twig, Stayblox exposes the globals, functions, and filters below. This page is generated from the app's dev:twig-contract command — the same contract the runtime registers — so what you see here is exactly what's available in a template.
These globals, functions, and filters are available to theme templates, exported from the app's dev:twig-contract contract and grouped by category. Each entry is tagged with its kind (global / function / filter).
Routing & URLs
route function
twig
route(name, ...params)Generate a localized URL for a named route.
route_localized function
twig
route_localized(name, ...params)Generate a localized URL for a named route.
⚠️ Deprecated — use
routeinstead.
route_base function
twig
route_base(name, ...params)Generate a non-localized URL for a named route.
url function
twig
url(path = null)Generate a URL for a path.
url_current function
twig
url_current()The current page URL.
localizedUrl function
twig
localizedUrl(locale)The current URL switched to another locale.
path function
twig
path(...args)Resolve an application path helper.
appendQuery function
twig
appendQuery(key, value)Append/replace a query parameter on the current URL.
routeIs function
twig
routeIs(name)Whether the current route matches a name/pattern.
menuActive function
twig
menuActive(...args)Active-state helper for navigation menus.
Assets & images
themeAssets global
twig
{{ themeAssets }}Base path for the active theme's assets, served through the theme.asset route.
theme_asset function
twig
theme_asset(path)URL to a file in the active theme's asset folder.
asset function
twig
asset(path)URL to a public asset.
media_url function
twig
media_url(...args)URL to an uploaded media file.
facility_icon function
twig
facility_icon(facility, weight = null, class = "facility-icon")Inline SVG icon for a facility or amenity. The weight defaults to the theme's icon_weight setting (thin, light, regular, bold, fill, duotone).
Returns HTML that is rendered as-is (not escaped).
getImage function
twig
getImage(image, size = null)Resolve an image path to a URL, falling back to a placeholder.
getGlobalImage function
twig
getGlobalImage(image)URL to a global (platform-wide) image.
getFilePath function
twig
getFilePath(key)Configured file path for a given key.
getFileSize function
twig
getFileSize(key)Configured file size constraint for a given key.
media_url filter
twig
|media_urlResolve an uploaded media URL: {{ path|media_url }}.
Localization & content
languages global
twig
{{ languages }}Published languages: [{code, name, name_local, image}].
t function
twig
t(key, replace = {}, locale = null)Translate a key.
lang function
twig
lang(key, replace = {}, locale = null)Translate a key.
⚠️ Deprecated — use
tinstead.
getTenantCurrentLanguage function
twig
getTenantCurrentLanguage()The site's currently active language.
config function
twig
config(key, default = null)Read an application config value.
sgs function
twig
sgs(key)Read a system general setting by key.
gs function
twig
gs(key)Read a general setting.
⚠️ Deprecated — use
general_settingsinstead.
siteName function
twig
siteName(pageTitle)Compose a page title with the site name.
trans filter
twig
|trans(replace = {}, locale = null)Translate a key: {{ "key"|trans(replace, locale) }}.
Content
latest_blog_posts global
twig
{{ latest_blog_posts }}The three most recent blog posts.
paginateLinks function
twig
paginateLinks(paginator)Render pagination links for a paginator.
Returns HTML that is rendered as-is (not escaped).
json_decode filter
twig
|json_decodeDecode a JSON string to an array: {{ json|json_decode }}.
Commerce & booking
featured_unit_types global
twig
{{ featured_unit_types }}Active, featured unit types (with facilities).
getCart function
twig
getCart()The current cart: { items, count, totalAmount, totalUnits }.
countAvailableUnits function
twig
countAvailableUnits(...args)Count available units for the given criteria.
Formatting
showAmount function
twig
showAmount(amount, decimal = 2, separate = true, exceptZeros = false, currencyFormat = true, isSystem = false)Format a monetary amount for display.
getAmount function
twig
getAmount(amount, ...)Normalize a raw amount value.
convertToReadableSize function
twig
convertToReadableSize(size)Human-readable file size.
showEmailAddress function
twig
showEmailAddress(email)Format/obfuscate an email address for display.
showMobileNumber function
twig
showMobileNumber(number)Format a phone number for display.
hexToHsl function
twig
hexToHsl(hex)Convert a hex color to {h, s, l}.
titleToKey function
twig
titleToKey(text)Slugify a title into a key.
pluralize function
twig
pluralize(word, count = 2)Pluralize a word unless count is 1.
enum_label filter
twig
|enum_labelHuman label of an enum: {{ status|enum_label }}.
url_encode filter
twig
|url_encodeURL-encode a string: {{ value|url_encode }}.
Dates
showDateTime function
twig
showDateTime(date, ...)Format a date/time for display.
daysDifference function
twig
daysDifference(checkIn, checkOut)Number of days between check-in and check-out.
diffForHumans function
twig
diffForHumans(date)Relative "x ago" representation of a date.
now function
twig
now()Current date/time.
nowAddDays function
twig
nowAddDays(days = 1)A date N days from now.
Forms & security
csrf_token function
twig
csrf_token()The current CSRF token value.
csrf_field function
twig
csrf_field()A hidden CSRF input field.
Returns HTML that is rendered as-is (not escaped).
getValidationErrors function
twig
getValidationErrors()Flat list of current validation error messages.
old function
twig
old(key, default = null)Previously submitted input value.
encrypt function
twig
encrypt(value)Encrypt a value.
Navigation
menu_items global
twig
{{ menu_items }}Resolved navigation items from the theme's config/menu.json (each item has label, resolved_url, open_in_new_tab).
Site
site global
twig
{{ site }}Site-wide links: { policies: [{url,title}], pages: [{url,title}] }.
Settings
general_settings global
twig
{{ general_settings }}System general settings (site name, contact, etc.).
settings global
twig
{{ settings }}Theme settings the host configured (general + SEO).
Apps bridge
app_slot function
twig
app_slot(slot)Render HTML that installed apps inject into a slot (head, body_start, body_end).
Returns HTML that is rendered as-is (not escaped).
Miscellaneous
gdpr_cookie global
twig
{{ gdpr_cookie }}Current value of the gdpr_cookie cookie.
app global
twig
{{ app }}Request context object: app.user, app.request, app.locale.
status global
twig
{{ status }}Status constants object, for constant() lookups.
payment_methods_enabled global
twig
{{ payment_methods_enabled }}Legacy flag; always 0. Use installed payment apps instead.
request function
twig
request()The current request instance.
iniGet function
twig
iniGet(key)Read a PHP ini value.
array_count_values function
twig
array_count_values(array)Count occurrences of values in an array.
branding
powered_by_url function
twig
powered_by_url(placement = "footer")UTM-tagged URL for the "Powered by Stayblox" footer link, attributed to the current site.
Using them together
twig
{% extends 'layouts/app.twig' %}
{% block content %}
<h1>{{ 'nav.home' | trans }}</h1>
{% for unitType in featured_unit_types %}
<article>
<h2>{{ unitType.name }}</h2>
<a href="{{ route('home') }}">{{ t('view_details') }}</a>
</article>
{% endfor %}
{% for item in menu_items %}
<a href="{{ item.resolved_url }}">{{ item.label }}</a>
{% endfor %}
{% endblock %}Prefer the non-deprecated names where a deprecation badge is shown above — the deprecated alias still works but may be removed in a future theme API.