This forum is for assistance with theme development.

Editing a link to a file

The original template (file-link.html.twig) sets a.title to the file name. I want a.title to display the file description field.
Is it the right and safe solution?

file-link.html.twig

How to get styled image in custom Views?

I have create custom template for my Views as shown below:

  •  views-view-unformatted--article_category_blocks--article-category-1.html.twig

Print the content of first row:

{{ rows[0].content }}

The image (field_image) has styled with "thumbnail" style in my Views.

Now, how to print the styled "thumbnail" field_image?

Inherite theme suggestions created by the parente theme

I have a theme X that implements X_theme_suggestions_page_alter. It adds a new template suggestions named "page__fwidth" for some content types.

When the theme X is enabled the theme loads the file named page--fwidth.html.twig for the desired content type.

Now, if I create a sub-theme Y that has X as the base theme and activate it, the suggestion defined by X is not available. Probably because the file X/X.theme is not loaded. How can I have all the stuff in X.theme loaded when the theme Y is activated?

Thank you

How to add javascript in head tag?

Hello, i am new in Drupal. I need to add a script in js to the <head></head> tag. Where is this part of the body in the drupal template.

I am working with drupal 9 and 10. Thanks you help.

Olivero, customize grid layout

Olivero's sidebar (.sidebar-grid .region--sidebar) is a bit too small, especially on the larger screens, to insert graphically interesting contextual blocks.
How to enlarge it safely?
I tried overriding in a custom-grid.css the grid-columns of '.sidebar-grid > .site-main, .sidebar-grid .region--sidebar' and apparently it works.
I'll probably have to increase the max-width of page-wrapper a little as well.

Then in cascade I will possibly have to make adjustments for the various @media.

Twig file don't get the value of Texonomy

Friends,

I created a view with four fields. Two of them are text fields and other two get the value from texonomy. I created four "Twig" files for eatch field.

1. Text field

views-view-field--dictionary--page-1--title.html.twig

Code used for output

{{row.content['#row']._entity.title.value}}

2. Text field

views-view-field--kosh--page-1--field_meaning.html.twig

Code used for output

{{row.content['#row']._entity.field_meaning.value}}

3. Value from Taxonomy

views-view-field--kosh--page-1--grammar.html.twig

Pages

Subscribe with RSS Subscribe to RSS - Theme development