Skip to content

Twig syntax

Filters

Standard Twig filters — https://twig.symfony.com/doc/2.x/filters/index.html

Functions

Standard Twig functions — https://twig.symfony.com/doc/2.x/functions/index.html

newsletter_subscribed

Parameters of newsletter_subscribed

AttributeDescription
emailrecipient email address
twig
{% if not newsletter_subscribed(user.email) %}
    Subscribe to the newsletter!
{% endif %}

Simplia filters

In addition to standard Twig filters, Simplia templates provide custom filters.

Price formatting

FilterDescriptionExample
cena (price)format price with currency{{ product.price|cena }}
mena (currency)format price with currency (alias){{ value|mena }}
mena_rounded (currency rounded)rounded price with currency{{ value|mena_rounded }}

Text

FilterDescriptionExample
orez (trim)truncate text to length{{ text|orez(100) }}
highlighthighlight search term{{ text|highlight(query) }}
prvniVelke (capitalize first)capitalize first letter{{ text|prvniVelke }}
diakritika (diacritics)remove diacritics{{ text|diakritika }}
stripremove HTML tags{{ text|strip }}
preg_replaceregex replacement{{ text|preg_replace('/pattern/', 'replacement') }}

Date

FilterDescriptionExample
date_localelocalized date{{ date|date_locale }}
relative_daterelative date (2 days ago){{ date|relative_date }}
addWorkingDaysadd working days{{ date|addWorkingDays(3) }}

Images

FilterDescriptionExample
imgSrcimage URL at specified size{{ image|imgSrc(300, 300) }}
imgSrcSetsrcset for responsive images{{ image|imgSrcSet }}
image_proxyURL through image proxy{{ url|image_proxy }}
gravatarGravatar URL for email{{ email|gravatar }}