This page demonstrates creating a dynamic layout for a chosen node content type with Display Suite.
No explicit PHP coding was used in theme templates. (Not that we are scared of them of course, but Display Suite certainly makes it a lot easier, and now covers so many cases that one does well to give Display Suite a go these days before turning to templates.)
The body has been assigned to the header of a 2-column stacked Display Suite layout. The image is assigned to the left and the caption to the right below the header.
After the other pre-existing fields in the footer are shown, a Display Suite code field is shown with dynamically generated content, including extracting the entity type of this from the $entity var in PHP.
Finally, to demonstrate a Display Suite dynamic field, the existing node Display Suite is chosen (using almost exactly the same process as used for existing content in Panels) and displayed as a teaser at the bottom of the layout footer.
© Copyright 2001 - 2016 Webel IT Australia (ABN: 67 677 268 579). All rights reserved (except as specified below).
PHP code examples from Webel IT Australia on this site are distributed under the GNU General Public License.
Excludes text and code snippets from Drupal.org quoted for educational purposes.
Drupal’s online documentation is © 2000-2014 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0.
PHP code from Drupal.org is distributed under the GNU General Public License.
Drupal® is a registered trademark of Dries Buytaert.
Text quoted from Wikipedia for educational purposes is made available under the Creative Commons Attribution-ShareAlike License.
Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.
Site developed by Webel IT Australia.