Update: I have written an updated version of this series over athttp://webwash.net. The updated version covers Display Suite 7.x-2.x.
This post is part of a Display suite series, Display suite part 1: Layouts and Styles andDisplay suite part 2: View modes and fields.
In part 2 of this Display suite series, I’ll show you how to create custom view modes and how to expose blocks as a field. Also don’t forget to check out theDisplay Suite for Drupal 7 playlist on youtube.
Custom views modes
In Drupal 7 entity view modes have become a lot more powerful. With Display suite you are able to create custom view modes for any node or comment, without writing any code.
NOTE: Check out this great blog post on how to create custom view modes in Drupal 7 with code.
To create a custom view mode, click on the View modes link from the Display suite administration page.
Click on Add a view mode, fill out the form then click on Save.
If we go back to the Manage display, you should see the view mode in theCustom display settings tab.
Exposing blocks as fields and custom fields
One of Display suites strength is the ability to create custom fields and exposing blocks as fields, let me explain.
Click on Fields link from the Display suite administration page.
Let’s say you want to add some hard coded call to action text into a content type display. You can do this by creating a field, then assigning it to a region like any other field.
Click on the Add a field link and fill out the form. Make sure you select the right Text format, for this example select Filtered HTML.
The other ability is to expose blocks as fields and then assign them to a region.
Click on the Add a block field link. Give the field a name then select which block you want to use from the Block select box.
Fill out the rest of the form then click on Save.
Go back to the Manage display page and assign the custom fields to a region.
As you can see Display suite is a very powerful module. It saves site builders from overriding a lot of templates.
If you have any problems or questions please leave a comment.