0

Based on twig template naming conventions I have created twig for any field type of given content:

field--node--myContentType.html.twig

Is it possible to use different twig when myContentType is visible in "full" view mode? I've already tried:

field--node--myContentType--full.html.twig

But it does not triggers. I can use node--myContentType.html.twig and node--myContentType--full.html.twig for full view of the node, but it doesn't work for field twig.

1

Field templates have no name suggestion for the view mode.

From the linked page:

This page lists the conventions used for the base html structure, the page, regions, blocks, nodes, fields, and other core components. (It's good to know that it is possible to create custom template name suggestions using function hook_theme_suggestions_HOOK_alter.)

You have to create a custom name suggestion.

You find the view mode in the variables of the field: Getting node view mode in field preprocess

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.