1

I like very much that in Drupal 8 you can create your own display modes (i.e. not just have "Full" and "Teaser", but create your own) and that you can reference Content via Entity Reference fields within Content. It's really neat and allows me to add arbitrary lists of content on pages and have them render as I like. EXCEPT there seems to be one small issue - the rendered entities always start with the title linking to the Content. There doesn't seem to be any way of getting around it.

Apart from creating my own templates for my display modes, is there any way I can prevent the Title displaying when I render Content in another piece of Content using an Entity Reference? This seems to be an oversight with a very useful bit of functionality - or am I missing something?

4
  • It is not an oversight. That's just how node.html.twig is written(if we're talking nodes). See how it behaves for full pages and teasers.
    – user21641
    Commented Feb 11, 2016 at 16:26
  • That's what I thought. However, it does reduce considerably the usefulness of being able to display Content within Content with Entity Reference fields. You can change the way fields are displayed as you like using built in Drupal - which is great - but you have to have the title linking to the Content displayed - which you would frequently not want when it comes to displaying content within content. It's a shame because with a simple change it would make the Entity Reference field so much more useful.
    – James
    Commented Feb 11, 2016 at 16:32
  • I use this a lot, displaying content in content, but if you want to make this look good, you have to do some tweaking of the layout, not only the title. So you will end up with a custom twig for this specific display mode, and there you can simply remove the label from the twig. It would be nice to configure this in the ui, but it is not a real problem.
    – 4uk4
    Commented Feb 11, 2016 at 17:31
  • @4k4 Yes, that is the conclusion I am coming to - I need to make templates. But it's kind of a shame you can't just hide the title in the same way you can with all the other fields.
    – James
    Commented Feb 11, 2016 at 17:47

1 Answer 1

1

As you've found out through comments, the title is currently hardcoded.

The reason for that is that the title isn't controlled by the view mode in the default behavior. It's whether the node thinks he's on his own page vs. not. A behavior that's not easily configurable.

Would have been nice to fix that but like many other things, we didn't enough time.

Apart from using templates to do, you could also consider to use Display Suite, just like in 7.x, it allows you to control the title, pick from different layouts and so on.

1
  • I don't like adding big modules just for the sake of a little bit of functionality, so I'm going to do this with templates for now. It would be great if this could be fixed in the future so that the display of the title field is modifiable just like all the others, since this severely restricts the usefulness of a very handy piece of functionality.
    – James
    Commented Feb 12, 2016 at 8:04

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.