Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahebrank/newcity_twig
Twig extensions and functions for Drupal 8
https://github.com/ahebrank/newcity_twig
drupal drupal-8 drupal-module twig-extension
Last synced: 4 months ago
JSON representation
Twig extensions and functions for Drupal 8
- Host: GitHub
- URL: https://github.com/ahebrank/newcity_twig
- Owner: ahebrank
- Created: 2016-09-28T12:36:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-23T18:26:34.000Z (8 months ago)
- Last Synced: 2024-09-26T09:22:49.631Z (4 months ago)
- Topics: drupal, drupal-8, drupal-module, twig-extension
- Language: PHP
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NewCity Twig Extensions
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 array
- `flattenfield`: traverse and flatten a render array
- `smarttrim(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 ``
### Debug helpers
- `nocomment` : removes HTML comments from markup
- `firstlevel` : debug dump only the top level of a render array## Functions
- `uniqid()` : generate a unique ID with PHP's `uniqid()`