- πΊπΈUnited States thelioness22 Charlotte, NC
I'm looking for an answer to this, as well.
I'm trying to get the youtube thumbnail URI in Drupal 8 twig view template so that I can use it as a CSS background for a div element rather than directly on the page in an img tag.
I see that I can find the URI using a preprocess function, but I can not figure out how to get the URI into the view template. Then for it to only apply to the specific content type I'm using.
themename.theme:
function THEMENAME_preprocess_image(&$variables) {
$variables['uri']
}
I was able to get it working by using '{{ fields.field_youtube.content }}' in the view template then setting the 'image.html.twig' template to only return '{{ attributes.src }}', however, this would target all images that happen to be using the global 'image.html.twig' template.
Is there a more appropriate way to get the youtube thumbnail URI into a twig view template?
Thank you.
Active
1.5
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I'm looking for an answer to this, as well.