Display Suite

The Display Suite module is extremely complex and powerful, allowing you complete control over how your content is displayed. There are multiple pages of documentation on Display Suite on drupal.org, as well as numerous videos (such as this one produced by Acquia). Here we’ll limit the scope to the two most common things I’ve used it for: arranging fields to display in columns, and embedding a view within a node display.

What you can do without Display Suite

 

Displaying fields in the sidebar

Depending on your needs, Display Suite can be overkill. If you have a field in a particular content type that you want to display in a sidebar -- rather than in the main body area of your page -- you can use a module called CCK Blocks. CCK Blocks adds an option to the configuration settings for each field (i.e. under Structure > Content types > [Some content type] > Manage fields > [Some field name]) for whether to enable a block for that field or not. If you do enable a block for a given field, you’ll typically want set the display format for that field to be “<hidden>” to prevent the field value from displaying twice on the page. Then, you can enable the block corresponding to the field, and place it in one of the sidebar regions of your theme (assuming your theme has sidebars, which most do). While the field block will only display if it has a value, you should set the block visibility settings to only display for the content type(s) that has the field in question (e.g. if it’s a field that’s part of the Person content type, set the visibility settings so that the block only appears on Person nodes.) Configuring it this way will marginally improve your site’s performance.

Depending on your theme, the sidebars may be more or less conspicuous: some themes, for instance, have a colored background on their sidebars. Putting a field in a conspicuous sidebar may highlight that field more than you intend. Using Display Suite instead of CCK blocks will allow you to put fields in columns within the main body area of the page display, freeing up your sidebars for other things (e.g. blocks generated by the Views module) that you do want to specifically highlight.

Displaying views on node pages

If you create a block display for a given view, you can enable that block on any page, including -- for instance -- all pages of a particular content type. (Drupal for Humanists describes how to create a timeline for each person, and display that as part of the person’s profile page.) The limitation to this approach is that the block that displays the view content will always be somewhat set apart from the fields on the page. If you want to embed a view within the fields (e.g. first display some fields, then display a view, then display more fields; or display a view in a column next to the fields), you need to use Display Suite.

Installing and enabling Display Suite

Display Suite requires Chaos Tools (CTools), which you should already have installed if you’ve installed Views. Install the module as per usual, and enable Display Suite and Display Suite UI. If you want to manage the display of forms (e.g. the node creation / editing form) using Display Suite, you can also enable Display Suite Forms.

Accessing a view within Display Suite

If you just want to display fields in columns, you can skip this section, which addresses how to make views available as pseudo-fields within the Display Suite interface.

First, make sure that the view that you want to use has a block display. (See section 12.2.2 and 12.3 for more about displays in Views.) Then, after you’ve installed Display Suite, go to Structure > Display suite > Fields > Add a block field. Give it a label (e.g. “Personal map view”). Under “Entities”, in most cases you’ll just want to check “Node”. If you’re using Display Suite to configure the display of user accounts and want to embed a view as part of the user account display, you can check “User” instead, but those are the two most common use cases. Leave the “Limit field” box empty. Use the “Block” dropdown to select your block; it should be under the “Views” header. For “Layout”, you can choose whether or not to include the block title; in most cases, you’ll probably just want the content, without the title. Save.

Configuring Display Suite

You can access the Display Suite interface for any content type through the usual “manage display” interface (i.e. Structure > Content types > [Some content type] > Manage display). Once you have Display Suite installed, there’ll be a new option at the bottom of the “Manage display” page labeled “Layout for [content type] in [display name -- e.g. “default”, “teaser”, etc.]” (so, for instance, Layout for person in default, if we’re editing the default display of the Person content type).

Use the dropdown to select a layout. If you just want a standard one-column layout, but want to embed a view amongst fields, you can choose “One column”. There are options for variants on two, three, and four columns; “stacked” means that there are regions at the top and bottom that span the entire page width, in addition to the columns. If you choose any layout, a preview will appear showing the different regions as dark gray rectangles. If you’ve activated Display Suite by choosing a layout and want to restore the defaults, you can also use the dropdown to select “Reset”. Hit “Save” after you’ve chosen a layout.

After saving, the “Manage display” page will reload, and will look a little bit like the block page, insofar as there’ll now be sections for each of the regions. Some of the metadata will appear as pseudo-fields (e.g. “Post date”, “Last modified”, “Author”), as will some of the other aspects of node display that you couldn’t previously customize (e.g. “Comments”). Any blocks that you’ve added as pseudo-fields (e.g. blocks generated by views, as described above) will also appear here. You can now drag and drop any of these fields or pseudo-fields into any of the available regions.

Tags: