Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 314120

Twig image style filter

$
0
0

Problem/Motivation

It seems that there is a significant regression in the control of image output in Drupal 8's theme layer. There is no replacement for being able to use image_style_url("thumbnail", $img_uri) within templates now and the task can only be accomplished through the use of contrib modules in conjunction with views.

Proposed resolution

In addition with being able to target specific image fields using twig (e.g. : "image--field_field-name.html.twig"), how feasible would it be to create a new filter in twig that returns an image style url?

<img
{{ attributes|without('src') }}
{{ attributes.src|style('thumbnail') }}
/>

Viewing all articles
Browse latest Browse all 314120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>