This forum is for assistance with theme development.

How to create template suggestion for image like IMAGE--BLOCK-TYPE or IMAGE--FIELD-TYPE

I'm struggling to make template suggestions like IMAGE--BLOCK-TYPE or IMAGE--FIELD-TYPE. I have three different block types(image1, image2, image3) with one image field(field_image_1, field_image_2 and field_image_3). And I don't know how to get suggestion like

image--block_image1.html.twig

image--block_image2.html.twig

image--block_image3.html.twig

or

image--field_image_1.html.twig

image--field_image_2.html.twig

image--field_image_3.html.twig

Is there any way to pass variable between two hooks

access custom field in node template from field template

I have a node template, node--newsletter.html.twig that has access to a custom variable field_download_link .  its a boolean and I can access it in the template via {{content.field_download_link[0]}}

the node template calls a field template via {{ content.field_nl_articles }}

from within field-articles.html.twig I would like to reference content.field_download_link from node--newsletter.html.twig (or pass the variable from the node template to the field template...either way I dont care, just need to see the value in the field template)

How to pass a custom filename for a Document media type field to file-link.html.twig

Hi, I have a standard Document media type with a field of filename in addition to the standard fields for the type.  I'm then using the Media Library in a text editor to embed a link onto a page for example.  Right now, it's happily printing out the original filename as a link, but I can't think of a way to pass the new custom filename into the file-link.html.twig so that I can render it instead of the original.

Any suggestions on how I can do this or something equivalent would be greatly appreciated!

Group type view

Hello everyone,

I am new to drupal and I wanted to ask you for help to make a view of group types to place it as the main page of my website, where it shows on the left side a single group list item and on the right side 4 group list items in grid shape .. When making the view as a block it does not show me the option to publish it on the main page as it appears in a normal content .. I accept suggestion for the cover of my website I am using Bootstrap for Drupal Base Distrib as theme. Thanks

Getting URL in Media Fields

Hi! I trying to get URL in Media Fields but I can´t.

I have a content type created with 2 fields, a MEDIA field (for video) and another IMAGE.

I am able to get the image url with: file_url(paragraph.field_local_img.entity.uri.value)

But I want to check if the URL of the MEDIA (Video) is empty and it doesn't works the same way.

How can I get the value of the Media URL?

Thx

How do I find out where a twig variable is coming from?

In Drupal, I need to change the output of a template. I'm curious where I can find out this variable chat or phone is originating from?  Is this field from a content type?

{% if chat or phone%}
<ul class="utilities-list no-bullet clearfix">

Pages

Subscribe with RSS Subscribe to RSS - Theme development