1

When I add a layout to my theme using .layouts.yml, it will show up in the display settings for various entities (for example, paragraphs and blocks).
I can then set the display to be of a certain layout, but doing so gives me template suggestions. When I try to implement one of the template suggestions, it doesn't even use the template in themes/custom/
/templates/.

So I am a little confused. Which should I use? It's easy enough to use a layout, but I feel like I should use templates more often than layouts.

I do remember reading that layouts were added in Drupal 8.3 as experimental module, so it sounds like templates existed before layouts. It sounds like it's up in the air as to which one is better to use, but I just wanted some more opinions.

  • 1
    I prefer to stick to vanilla template theming. When you add Panels and Display suite etc you start adding a lot of new layers to work with and debug. In some cases you also incur performance penalty either local dev, prod, or both. – Kevin Aug 5 '18 at 14:54
  • Do templates get picked up automatically in themes/custom/my_custom_theme/templates/? It doesn't seem like it's working for me but maybe I am not using the correct suggestions. – cchoe1 Aug 5 '18 at 16:23
  • Yes, if the filenames match they will. – Kevin Aug 5 '18 at 16:34
2

Before Field Layout was added to core this functionality was provided in contrib by Display Suite. With these modules you can configure layouts in UI instead of theming them in node/block/paragraph templates. This is not about one versus the other, this is more about the skill level needed to change the layout. You can use both methods at the same time. However, when you install one of these modules they add a new layer to theming, so you need to adjust any existing node/block/paragraph templates which changed the field layout.

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.