This documentation is written for the 8.x-2.x version of Display Suite.

By following this method the site builder gets a block to place that can have a set of fields as defined by a view mode. The block's display can be templated in twig accordingly, and its theming will reflect any selected layouts in the display suite controls.

For example, you can create fields that appear as a block in a "hero" or "billboard" region, which will display automatically in the hero when visiting the page for that node, which is showing the default display mode in the main region of the page.

Configure

  • Install ctools module
  • Configure a new view mode (admin/structure/display-modes/view) with all the needed fields (under "Manage Display" of the respective content type)
  • Go to Administration > Structure > Block (admin/structure/block)
  • Click Add block in the region you want to display the fields
  • Place a "Entity view" block, that will have the category of Chaos tools
  • Select the newly created view mode from the select list
  • Set any other visibility constrains and save the block

Add a new entity view block

Select the view mode

See also

Comments

forschi’s picture

Very quick and smooth solution!

However, along with the fields I select, the page title is always displayed at the top of the block. Is there a way to avoid this behaviour?

stevecowie’s picture

The quick way is to apply a class to the block, which can be done in the block configuration form. You could then target the title with css and use display: none. A more complex approach is to create a node template based on the view mode you have used for rendering the block. Suppose, for example, your side fields belong to a content type called 'page' and you have used the 'token' display mode. You will have the following options for twig templates"

Instead of using the default template, use node--page--token.html.twig In that template just add the fields you want to show, and there will be no title.

karolus’s picture

Although using CSS to hide the title will help for visual users, it isn't recommended from accessibility and SEO standpoints. To get around it, what you can do is create a Twig template, and only add the fields you wish to print. Although some may point out that there is the Display titlecheckbox, I found that the title would display, even with this option turned off.