String Modifiers within partials #7720
-
Hello together, I am trying to do a really basic task. I have a variable called objekttitel and I am trying to modify it with antlers built in modifiers. {{ if objekttitel | is_empty }}
{{ 'Kein Titel' }}
{{ else }}
{{objekttitel | truncate(30, '...')}}
{{ /if }} I get following error message "Modifier [truncate(30, '...')] not found". I have already checked that var objekttitel definitely is a string and i can't really figure out what is missing in piece of code. I have also tried other modifiers such as substring, ... and they all don't work, except of a few like length and also is_empty. Would really appreciate any help :D |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey there! Sounds like the Antlers version is set to To change the Antlers version, in <?php
return [
// ...
'version' => 'runtime',
// ...
]; If its already set like that, or you still receive the error after the change, you can try clearing the configuration cache using: php artisan config:clear If you decide to change the Antlers version, your condition can be simplified to the following: {{ (objekttitel | trim | truncate(30, '...')) ?? 'Kein Titel' }} |
Beta Was this translation helpful? Give feedback.
Hey there!
Sounds like the Antlers version is set to
regex
; that new syntax is only supported with the newer Antlers version. If you need to continue using that version, the docs here will help with passing arguments to modifiers: https://statamic.dev/antlers-legacy#stringshorthand-styleTo change the Antlers version, in
config/statamic/antlers.php
you can set theversion
entry toruntime
:If its already set like that, or you still receive the error after the change, you can try clearing the configuration cache using:
If you decide to change the Antlers version, your condition can be simplified to…