Now that we have EntityDisplay objects holding display options for all the components of an entity view, we can start plugging them with the existing core layouts.
This will probably involve some refactoring to see how we can best reuse the logic in the existing Drupal\layout\Plugin\Core\Entity\Display objects.
More importantly, though, the first issue we need to address is the overall impact on the theming layer.
Namely, if a node view is primarily a collection of contents within regions, then node.tpl.php basically becomes something like :
<?php foreach ($regions as $name => $content): ?>
<div id="<?php print $name; ?>">
<?php print render $content; ?>
</div>
<?php endforeach; ?>
Meaning : something that themers can absolutely not work and mess with...
Just looking at the current bartik's node.tpl.php shows that we currently very much rely on custom markup (for example around node title) or custom placement (comments, links...) in there.
So the question is :
Do entity layouts mean that we must forget editing [entity_type].tpl.php files, and that all the stuff we currently do there has to be done in the UI ? (which sounds pretty bad, if not a no-go...)
- Curious to hear about people working with D7's Display Suite layouts and / or Panelizer can say about this
- Dunno if Twig can bring something interesting to the table on this aspect ?
Comments
Comment #0.0
yched commentedfix code
Comment #0.1
yched commentedfix code
Comment #0.2
yched commentedmention node links
Comment #1
swentel commentedI don't think we should remove that ability, but it would make sense to me to at least to have the ability to control the placement of all (useful - but where to we draw the line here) properties on an object.
Some thoughts:
Comment #2
andypostSuppose this way should lead to something like entity--view-mode.twig wrapper to allow themers to do their magic/staff on render
Comment #3
andypostFor core I think a render() #container__entity element is enough
Comment #4
andypostIs this still in D8 roadmap? or D9...
Comment #4.0
andypostformulation
Comment #7
tim.plunkettOops, missed this.
Closing as a dupe of #2796173: Add experimental Field Layout module to allow entity view/form modes to switch between layouts / #2795833: [plan] Add layouts to entity displays (both form and view) now though.