- Guides & Documentation
Knowledgebase
Featured articles, how-to guides and quick tips.
Make Field Value Lowercase in Twig - Drupal 8
In your field.html.twig file, it's as simple as switching out:
{{ item
.content
}}
for:
{{ item.content|render|lower }}
If you need to expand on that further, and perhaps replace spaces with dashes (which might be really helpful in a portfolio or filterable view), you can use something like this:
{{ item.content|render|lower|replace({' ':'-'}) }}