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 4 ■ Taxonomy<br />

Figure 4-5. The complete list of terms<br />

At this point we’ve created a vocabulary and the terms that we will use to categorize content. By default,<br />

taxonomy terms are sorted alphabetically, but in some cases you may need them to be sorted differently. For<br />

example, you may have a vocabulary for regions in the United States, with the terms East, Central, Mountain,<br />

and West. If the terms were sorted alphabetically, they would appear as Central, East, Mountain, and West.<br />

You may want the terms sorted in an east-to-west fashion, meaning the order should be East, Central,<br />

Mountain, and West, in which case you would want the order to differ from the default order. You may<br />

reorder the terms by simply clicking and holding the arrows icon to the left of a term and dragging that item<br />

to the position in the list where you want it to appear. Remember to click the Save button after reordering, as<br />

the order is not permanent until you save the list.<br />

We now have to identify which content types will use this vocabulary as a method for categorizing<br />

content, and configure our vocabulary so that it will appear on the content creation screens for those<br />

content types.<br />

Assigning a Taxonomy Vocabulary to a Content Type<br />

Enabling content authors to assign one of the terms to a new piece of content requires that a site<br />

administrator make changes to the content types. The first step is to identify all the content types that you<br />

want to associate with the new vocabulary. You may decide that all content types will use the vocabulary to<br />

categorize the content created on your site, or you may decide the vocabulary is only appropriate for one or<br />

a few content types. For example, if you had a vocabulary that listed terms for event venues (e.g., cafeteria,<br />

gym, courtyard, soccer field, and so on), you might want to restrict which content types could be used. That<br />

vocabulary may only be appropriate for a Calendar event content type and not your Basic page content type.<br />

As an example, let’s update the “Article” content type on the test site to incorporate the ability to tag<br />

content with the type of sport vocabulary. The first step is to click the Manage link in the admin menu at the<br />

top of any page of your site, and then click Structure. Click the “Content types” link to get to the page that<br />

lists the available content types (shown in Figure 4-6).<br />

39

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

Saved successfully!

Ooh no, something went wrong!