Skip to main content

MMO-DEV WEB Filters

Filters​

truncate​

Truncates text to the specified length:

truncate
{{ article.content|truncate(200) }}
{# Truncates to 200 characters and appends "..." #}

{{ text|truncate(100, '…') }}

date_format​

Formats a date according to the MMO-DEV WEB locale:

date_format
{{ post.createdAt|date_format }}
{# Default format from project settings #}

{{ post.createdAt|date_format('short') }}

json_decode​

Decodes a JSON string into an object or array:

json_decode
{% set data = json_string|json_decode %}
{{ data.name }}

{% for item in json_array|json_decode %}
{{ item.title }}
{% endfor %}