I have a custom field field_platform (referencing a the custom paragraph type platform) and a template for my field: field--field-platform.html.twig. Is there a way to override this for a specific display mode of the referenced paragraph type? I have a mode named cover_view for the custom paragraph type platform I want to override the field template for.

I found Field template for display mode but the template suggestion is for the display mode of the content, not the referenced paragraph.

Drupal 8.5.6, Paragraphs 8.x-1.3

Thanks in advance!


1 Answer 1


Implement hook_theme_suggestions_alter like in the other answer and you can find everything you need in the $variables.

The following snippet will add the template suggestion for the view mode of the referenced paragraphs. Note that this will probably only make sense as long as you use only one paragraph type OR all multiple paragraph types have the same view mode configured.

 * Implements hook_theme_suggestions_HOOK_alter().
function MYMODULE_theme_suggestions_field_alter(array &$suggestions, array $variables) {

  $element = $variables['element'];

  if ($element['#field_type'] == 'entity_reference_revisions') {

    foreach ($element as $key => $value) {
      if (is_numeric($key) && isset($value['#paragraph'])) {

        $paragraph = $value;
        $suggestions[] = 'field__' . $element['#field_name'] . '__paragraph__' . $paragraph['#view_mode'];

Seems you can implement that from you theme's *.theme file as well.

I guess the same logic works for any entity (node etc.) reference as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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