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 20 ■ Building a Company Site<br />

Figure 20-14. Assigning users to the Staff role<br />

Click the Apply button, and all of the user roles that we checked are now assigned as Staff, making it<br />

easy to use views to extract the list of user accounts to display as key staff members on the site.<br />

To create the view, select Users from the Show select list in the View Settings area of the “Add new view”<br />

page, followed by clicking “Save and edit.” Add a Page display, use “staff” as the URL in the Path field, and<br />

add the page to the Main navigation menu via the Menu field. Add a Title to the view, set the Format to Grid,<br />

and display 3 users per row in the grid’s settings. Unlike the content views that we’ve created previously in<br />

this chapter, we are going to use specific fields to construct a gallery of staff. The three fields that we’ll add to<br />

the view are the User’s picture, First Name, and Biography. Remove the Name field that is added by default.<br />

Also trim the user’s biography to the first 300 characters by clicking on the rewrite results section of the field<br />

configuration form and selecting Trim this field to a maximum number of characters, entering 300 as the<br />

value in the Maximum number of characters field. Add a Filter to only show users who are assigned to the role<br />

of Staff. After making those changes, we are ready to save the view and examine the page (see Figure 20-15).<br />

225

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

Saved successfully!

Ooh no, something went wrong!