Useful Drupal 8 Twig extensions
A Drupal 8 module to provide some useful Twig extensions and functions, (*1)
Currently includes:, (*2)
resize(style)
: resize an image with an image style; returns image render arrayflattenfield
: traverse and flatten a render arraysmarttrim(wordCount)
: a smarter truncation function (Example: content.field_text|render|striptags|smarttrim(n)
)alias
: get path alias for an entitymultilinesuperhead
: Break a multiline heading by wrapping all words except the last in <small>
nocomment
: removes HTML comments from markupfirstlevel
: debug dump only the top level of a render arrayuniqid()
: generate a unique ID with PHP's uniqid()