Download the PHP package burdapraha/drupal_twig_food without Composer
On this page you can find all versions of the php package burdapraha/drupal_twig_food. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download burdapraha/drupal_twig_food
More information about burdapraha/drupal_twig_food
Files in burdapraha/drupal_twig_food
Package drupal_twig_food
Short Description Useful functions, filters for twig @ Drupal 8
License GPL-2.0+
Homepage https://github.com/BurdaPraha/DrupalTwigFood
Informations about the package drupal_twig_food
DrupalTwigFood
Useful functions, filters for twig @ Drupal 8
Instalation
Recomended using is via Composer:
composer require burdapraha/drupal_twig_food
... and install module "Burda Twig Food" in administration (domain.tld/admin/modules)
Documentation
The best documentation is easy examples, right? :-)
Functions
- svg($path)
offering comfortably using svg images in templates, example: when file is stored in "/your-theme-name/images/awesome_icon.svg" and source code of svg will be printed to page as is. This solution is quick and you can use CSS features like ".your-div svg {fill: red}" etc.
- load_block($id)
you can call block by name anywhere in template:
- load_region($id)
this function offers print all block of the region anywhere you need:
- load_main_node($returnId = true)
solving problem with getting node id from anywhere template when you need it
- load_gallery_prev($currentGalleryId, $thumbnailStyle = 'thumbnail')
array with previous media gallery:
- load_gallery_next($currentGalleryId, $thumbnailStyle = 'thumbnail')
array with next media media:
- load_gallery_thumbs($galleryId, $thumbnailStyle = 'thumbnail')
array with images from gallery:
Filters
- naked_field
return rendered field, for example from view, without developers suggestions (), without HTML tags like <a href="xy">your_filed</a>
. Just naked string what you can use as class, data attribute or in twig condition! Using example: {% set badge = content.field_show_badge|naked_field %}
- max_length($max = 0, $dots = true)
Check string length and return him summary or in original. It is pretty alternative to ugly . By second parameter you can disable adding "..." to the end of string.