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
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 9 ■ Views<br />
In the second column of configuration options (refer to Figure 9-3), we’ll begin<br />
by defining the Page Settings for our example.<br />
8. Every View display that is defined as Page must have a unique URL, specified in<br />
the Path field. For our example, let’s use “/all-articles” as the URL. Click “No path<br />
is set” and on the “The menu path or URL of this view” form enter all-articles in<br />
the Path text field. Click the Apply button to continue.<br />
9. The Menu field gives us the option to add our View display page to a menu.<br />
For demonstration purposes, we’ll add it to the “Main navigation” menu. Click<br />
the “No menu” parameter and click the “Normal menu entry” option. On the<br />
configuration page for adding the menu entry, enter a title, a description, and<br />
select “Main navigation” as the menu on which this item will be displayed. For<br />
sites that you are building, you may want to add a View page to a menu other<br />
than the “Main navigation” menu. Click the Apply button after entering the<br />
values on the form.<br />
10. Views provides the ability to restrict who can see the output generated by this<br />
View display. You can set the Access restrictions to<br />
• None: Anyone can see the output.<br />
• Permission: The visitor must be assigned to a role that has permissions to view<br />
the output.<br />
• Role: The visitor must be assigned to a specific role to see the output.<br />
By default the value is set to Permission, where the default permission is that the<br />
visitor must have the ability to view content on the site (see figure 9-3). In most<br />
cases the default values are appropriate. For our example page, we will leave<br />
them set to the defaults, which is that only visitors who have the ability to view<br />
content will be able to see the output of the view.<br />
11. The Header setting enables you to add several things to the top of your view. For<br />
example, you could provide an introductory paragraph that describes the content<br />
rendered by the view, or a block that you have defined on your site, the output of<br />
another view, or several other elements. Click the Add button and select from the<br />
list of options. The most common option is to add an introductory paragraph; to<br />
do so, click the “Global: text area” option, select the “This page (override)” option<br />
in the For select list at the top of the options, and click the “Apply (this display)”<br />
button. On the next form, enter the text that you want to display at the top of<br />
the view. If you want the header text to display even when there are no results<br />
for your view, check the “Display even if view has no results” box, followed by<br />
clicking the “Apply (this display)” button.<br />
12. The Footer setting, similar to Header, enables you to add a footer to the output of<br />
a view. Follow the same steps as listed in step 11 to insert a footer at the bottom<br />
of the view.<br />
13. If your view returns no content—for example, there are no published Articles on<br />
your site—you can alert the visitor that no content exists by displaying a message<br />
via the No Results Behavior setting. The process for creating the message is the<br />
same as for creating the header and footer. Follow the directions in step 11 to add<br />
a message when no results are found.<br />
105