2

I am using Drupal 8.

I have a content type of Browse that has a bunch of paragraphs that can be inserted into each field_region. Inside field_region_iv_d I have a reference entity field that just references the Blog content type. So when creating the Browse Content you can click on the field_region_iv_d field and then select add blog and you just start typing the title of the blog and it auto completes.

So now on the actual Browse page if you are viewing the page. Where the region_iv_d is supposed to display I need all of the referenced blogs to display in this spot. I can not for the life of me figure out how to get this to display. I could possibly have this setup wrong. Maybe I need to use a twig field template? Maybe I need to add some special preprocessor code? I have tried a ton of different preprocessor code and was unable to get this results that I am looking for.

Here is general view of my setup.

content type = Blog

content type = Browse
|___ field: Region D - field_region_iv_d - Entity reference revisions

Paragraph Type = 'Blog Block - blog_block
|_ field: Blog Reference - field_blog_reference - Entity reference
|_
Manage Display: Blog Reference - (Label)Above - (Format)Rendered Entity

Twig Template: paragraph-blog-block.html.twig

  • Shouldn't the twig template name be paragraph--blog-block.html.twig? – Kevin Jan 11 '17 at 1:07
  • 1
    Also what theme are you using, and post your custom twig template code if you have any. Simply outputting {{ content }} or {{ content.field_blog_reference }} should iterate over each field delta and render its contents according to your formatter setting. I have done this same thing on a project I am working on and it works just fine... so there has to be some culprit. The default paragraph.html.twig that comes with Paragraphs would do this automatically unless you have an override. – Kevin Jan 11 '17 at 1:09
  • Yes, it shows template name at bottom. That should be correct. paragraph--blog-block.html.twig. I think my problem is that field_region_iv_d is an entity reference that references the paragraph entity reference that references the blog entity. So its multi layered entity reference. Think this could be some of my problem? – Atrium Jan 11 '17 at 17:09
  • Shouldn't be, I am doing the same thing. – Kevin Jan 11 '17 at 17:13
  • {{ content.field_blog_reference }} displays only the title. It doesn't give me any of the field values. – Atrium Jan 11 '17 at 18:54

Your Answer

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

Browse other questions tagged or ask your own question.