18.11.2015 Views

Beginning Drupal 8

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 5 ■ Content Types<br />

If you click the select list for the Format of each field, you will find a selection of options depending on<br />

the field type. For text-related fields, the options are<br />

• Default: The content will be rendered on the screen as you specified when you<br />

created the field.<br />

• Summary or Trimmed: If the field type has a summary value and a body value, the<br />

summary value will be displayed. If there isn’t a summary, the body value will be<br />

trimmed to a specified length.<br />

• Trimmed: The content will be “trimmed” to a specified number of characters. If the<br />

content is longer than the specified number of characters, a “Read more” link will be<br />

displayed.<br />

• Hidden: The content will not appear on the screen.<br />

For other field types, the options are dependent on the type of content being displayed.<br />

To reposition a field, click and hold the arrows icon next to the field label of the item you wish to move,<br />

drag the field to the position where you want it to appear, and release your mouse button. Remember to click<br />

the Save button after you have moved all of the fields to their proper position.<br />

We can also define how the content is displayed for other modes beyond default and Teaser, such as<br />

RSS, Search index, and Search result. To enable those modes simply click the “Custom display settings”<br />

link at the bottom of the Manage display page to expand the list and select from the list of modes. With the<br />

additional modes enabled you can then define how your content is displayed when, for example, an Event is<br />

displayed on the search results page.<br />

You can also define your own modes that may be used to display content differently under various<br />

scenarios. To create a new view mode visit Structure ➤ Display Modes ➤ View modes and click on the<br />

“Add new view mode” button. Select Content from the list of options and when prompted, give your view<br />

mode a name (e.g., featured). Once your new view mode has been created you can then use that mode on<br />

the Manage display page to define the unique output for that view mode.<br />

Summary<br />

Content types is one of the “killer app” aspects of <strong>Drupal</strong>, and is an important concept to understand.<br />

While you could construct a <strong>Drupal</strong> site with just the Basic page and Article content types, it is likely that<br />

you’ll want to leverage the features and functions provided through the use of custom content types. In this<br />

chapter I demonstrated just one of the custom content types that I create for nearly every site that I build<br />

for my clients. Other custom content types that I frequently use include Customers, Products, Departments,<br />

FAQs, Locations, and Employees. As you design and develop your new site, I’m sure you’ll identify one or<br />

more custom content types that you could use.<br />

Another powerful feature of custom content types is the ability to develop custom reports or “views” of<br />

custom content type data that is stored in the <strong>Drupal</strong> database. If you think about the Event content type we<br />

created in this chapter, it might be valuable to generate a list of events sorted by the start date, or a list sorted<br />

by venue.<br />

The next chapter provides an overview of <strong>Drupal</strong> themes. Now that we have content, let’s make it<br />

look good!<br />

72

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!