ahebrank / newcity_twig
Useful Drupal 8 Twig extensions
Installs: 2 047
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:drupal-module
This package is not auto-updated.
Last update: 2024-11-10 20:22:46 UTC
README
A Drupal 8 module to provide some useful Twig extensions and functions
Currently includes:
Extensions
Render helpers
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 entity
Project-specific but potentially useful
multilinesuperhead
: Break a multiline heading by wrapping all words except the last in<small>
Debug helpers
nocomment
: removes HTML comments from markupfirstlevel
: debug dump only the top level of a render array
Functions
uniqid()
: generate a unique ID with PHP'suniqid()