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.

Formatting the Output of a Custom Content Type<br />

Chapter 5 ■ Content Types<br />

There will be times when the visual representation of your new content type as displayed to the end user of a site<br />

doesn’t fit with how you would like the content created with your new content type to be rendered on the screen.<br />

In the previous section we looked at rearranging the fields on the form used by content authors to create an<br />

event; in this case we are rearranging the content as it appears when an event is rendered to an end user.<br />

Adjusting the order and positioning of the labels in relation to the field can be accomplished by clicking<br />

the “Manage display” tab on the custom content type edit form.<br />

We will use our Event content type to demonstrate the capabilities. Clicking the “Manage display” tab<br />

reveals the page shown in Figure 5-32.<br />

Figure 5-32. “Manage display” page<br />

This page lists all of the fields that are associated with our content type, and provides the ability to<br />

define basic display attributes for the label and content for each of the fields. By default there are two sets<br />

of values that we can set: one for the Default (full node) and one for the Teaser view. The Default option<br />

displays the complete content item and Teaser displays just the content item’s title and a trimmed version<br />

of the body field. You can switch between these using the two links at the top left of the page. If you click the<br />

select list for the Label of each field , you will find that there are three options:<br />

• Above: The label will be displayed on a line immediately above the widget that you<br />

selected for your field.<br />

• Inline: The label will be displayed to the left of your widget, on the same line as the<br />

widget.<br />

• Hidden: The label will not be displayed on the screen.<br />

71

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

Saved successfully!

Ooh no, something went wrong!