Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I got this from Stack Exchange. It makes it possible to have individual twigs for display modes:
https://drupal.stackexchange.com/questions/201210/field-template-for-dis...
Makes theming a much better experience.
function MYTHEME_theme_suggestions_field_alter(&$suggestions, $variables) {
$suggestions[] = 'field__' .
$variables['element']['#field_name'] . '__' .
$variables['element']['#view_mode'];
}
Comment | File | Size | Author |
---|---|---|---|
#2 | theme-suggestions-for-fields-content-type-view-mode-specific-2962578-2.patch | 686 bytes | tanmaykadam |
Comments
Comment #2
tanmaykadam CreditAttribution: tanmaykadam as a volunteer and at QED42 commentedI have added a patch for theme suggestions.
Comment #3
HongPong CreditAttribution: HongPong at kor group commentedThanks tanmaykadam this is working as expected! Committing now.
Comment #5
HongPong CreditAttribution: HongPong at kor group commented