VIEWS TERMINOLOGY
-
Content v. Fields: When a display is in the 'content' mode, view results can be shown in any of the standard ways they can appear on your site, such as teaser, title, or full. 'Fields' are the individual pieces of information that make up the elements (like content items, users, and comments) that appear in your view. If you switch a display to the 'fields' mode, you can choose which fields are shown in that display; for example the title, post date, author, images associated with the content, etc.
-
Contextual filters: These filters can do several things, including changing your view dynamically depending on where or how your view is shown on your site. For example, the same view can show one author's most commented posts on their blog page and show another author's on theirs. Contextual filters can also act as meta-filters, filtering and displaying the items in your view based on information about them (meta information) rather than just information in them, which is what normal filters do. For example: you can sort and display how many posts were published in each of the last few months, based on a contextual filter that sorts and summarizes their post dates.
-
Displays: These determine how your view is output, which could be a page, block, feed, or attachment. Every display can be individually configured and a view can have multiple displays, including multiple displays of any given display type. For example: you can build a single view that is displayed as a block, a page, and an RSS feed.
-
Exposed filters: These allow your site visitors to customize the view they are looking at with one or more controls. For example, exposing the 'Sort criteria' filter allows visitors to order view results in ascending or descending order. Almost any filter criteria can be set to be 'exposed' to your site visitors.
-
Filters: These are the basic selection criteria for what gets included in your view. Filters include characteristics like content type, published state, tags, content author, etc.
-
Pager: When your view result contains more items than the limit set for a page or block display, you can add and configure a pager to link between multiple pages or to link from a short block display to a complete page display.
-
Relationships: These add the ability to expand your view to include information from items that are not directly part of your view's results. For example, adding the relationship 'Comment: user' to a content view makes all the fields related to the authors of any comments made on that content available to your view, too.
-
Views: A contributed module which is a simple interface for creating displays of various Drupal objects; like content, products, orders etc. Views permit selection of specific fields to display, filtration against various attributes, choice of basic layout options and other more advanced features.
UNDERSTANDING THE EDIT PAGE
You can always reach the 'Views' main page by navigating to: Structure > Views, from there you can edit a view by selecting the edit button to the right of the appropriate choice.
EDIT PAGE LAYOUT
The view edit page is divided into areas, each focused on a different aspect of your view: displays, content, and so on. Every link and drop-down control on the edit page lets you change or configure some aspect of your view.
-
View controls: The controls at the top of the edit page manage your view. Each display (page, block, feed, etc.) has a button. Clicking a display button opens it in the editing area at the center of the page and in the preview area at the bottom.
-
Display controls:
-
Display details: The controls at the top of the display details area let you name, clone, and delete your display.
-
Left panel: The controls in the left panel manage how the view results are shown in the display: title, format, content or fields, filters, and sorting.
-
Center panel (Display settings): The controls in the center panel let you define the URL path, menu link, access (permissions), header, footer, and pager.
-
Right panel (Advanced): The controls in the right panel let you define advanced aspects of your display: relationships to make more fields available to it, contextual filters to make it behaves differently depending on how it is used, 'No results behavior' or what to do when your view comes up empty-handed, and 'Other', which for most views, you will most likely never use.
-
Preview area: The bottom area of the edit page shows you a preview of the current state of the selected display and should automatically update it as you make changes unless you deselect the Auto preview box. Each part of the preview also has pop-out gear menus that show you the current view settings and give you access to controls to make changes.
IMPORTANT VIEW TIPS
-
Clone: If you are not familiar with Views, before making any changes to an existing view, we highly recommend that you 'clone' the view and try out your changes on the clone version first.
-
Saving changes: All changes you make to your view on the edit page are temporary until you click Save. For example, if you change the sort criteria and click OK in its window, the change will be lost if you leave the main view edit page without clicking Save. We highly recommend that you save your work frequently - especially when you see the message 'All changes are stored temporarily. Click Save to make your changes permanent. Click Cancel to discard your changes.'
-
Access: Under the 'Access' settings within the 'Page Settings', you can control who access to this view. By default this is set to 'none' meaning anyone on your site can acess the view you have created.
-
Administrative names and descriptions: It will help you manage and identify your views and displays if you utilize the fields that allow you to add optional descriptions or names
-
Apply options: When working in settings, always change the ‘For’ option from ‘All Displays’ to ‘This block (override)’ so that the changes you make only alter the block (or page) you are working on. The ‘Apply’ button should say 'Apply (this display)'.
CREATING A VIEW
Views is a powerful tool and you can create them with many different options. The instructions below guide you through creating a simple view with a page and a block display for one content type. Specifically, we’re creating a view page that will display all of our store mugs with the mug name and image and a block which will display one mug at a time.
Navigate to: Structure > Views
-
Select ‘Add new view’
-
Enter a name for the view
-
Enter an additional description for the view (optional but recommended)
-
Select the Description check box
-
Enter your description - this description is displayed to administrators on the Views list page.
-
Select what you want this view to display:
-
Show - select an item from the list of available choices, for this example we’re choosing ‘Content’
-
Of Type - select all or refine your view by selecting an individual category, for this example we’re choosing the content type 'Mugs'
-
Sorted by - select the order in which you wish items to be displayed, for this example we’re choosing ‘Newest first’
-
Determine if you want to create a ‘Page’ or a ‘Block’ and select the appropriate check boxes. For this example, we want to create both so we have selected both together.
-
Configure the new page and/or block using the settings that appear:
-
Page/Block title - This will automatically default the same name you entered previously in step 2. However, you can change it if desired. This title will be used in the display at the top of the page and in various parts of the browser.
-
Path (only available for ‘Page’) - This will be the path used to navigate to the page you are creating - use the default or set a custom path
-
Display format - Determine how this information is presented to your visitors:
-
Grid - A configurable table-like format (this is the option we’re choosing for this example)
-
HTML list - An ordered or unordered list with configurable CSS options
-
Jump menu - A menu listing of links to the view items
-
Table - A dynamic, configurable table with sortable columns
-
Unformatted list - A simple list of the view items without any CSS
-
Select what to show on views of content:
-
Teasers or full posts -
-
Titles - content titles only
-
Titles linked to content items
-
Fields - sets which fields (title, body, author, etc.) will be displayed (this is what we’re choosing for this example)
-
Items to display - Specify the number of items your view displays on a page, with a pager to navigate between them
-
Use a pager - Allow site visitors to see additional results if there are more results than can be displayed on the page (based on the Items to display field)
-
Create a menu link (only available for ‘Page’) - Add a menu link to any navigation menu of your choice on your site
-
Include an RSS feed (only available for ‘Page’) - Add a feed to let visitors follow updates to your view
-
Continue & Edit
-
Select the ‘Page’ display
-
Under 'Fields' select ‘Add’
-
Select the Content: Image option that appears in the 'Mugs' content type
-
‘Apply this display’
-
Configure the field accordingly to your desired preference and ‘Apply this display’
-
Save
-
Select the ‘Block’ display
-
Under 'Fields' select ‘Add’
-
Select the Content: Image option that appears in the 'Mugs' content type
-
‘Apply this display’
-
Configure the field accordingly to your desired preference and ‘Apply this display’
-
Save
NOTES:
-
Under the ‘Filter Criteria’ and ‘Sort Criteria,’ you will have fields already in place. Those options came from the choices you made during steps 4a through 4c. Additional options can be added by selecting the ‘Add’ button and choosing additional fields.
-
Content: Published (Yes) - Filter
-
Content: Type (=Mugs) - Filter
-
Content: Post Date (desc) - Sort
-
Under the 'Access' settings within the 'Page Settings' options, the default will be set to allow any user with the permission to view published content, to view the display created. You can change this access based on what content is being made available and who it is meant for. For example, using the view we created for 'Mugs', we could restrict it so that only users with an 'authenticated user' role can view the display.
-
Under the 'Access' settings within the 'Page Settings' select 'Permission'
-
Select 'Role' - Apply (this display)
-
Select 'Authenticated User' - Apply (this display)
-
Save
You have now created a page that can be found following the path you created in step 6b.
The block you created is disabled by default. If you want site visitors to view the block, you must enable the block and place it on your website by navigation to Structure > Blocks and configuring the block to appear in the region of your choice and on the pages of your choice.
This concludes our review of 'The Basics of Views’. To learn more about the different types of views visit our 'Help Center' and select the 'Views (Advanced)' category.