Displays allows you to use same kind of information in different forms across the site.
General Settings For All Views
- Go to admin/structure/views/settings to change the general settings for views. For example you can show the Master display, expand the advanced settings automatically, display the SQL queries and performance statistics.
Note the new feature in Drupal 8: you can now duplicate displays as different types.
Attachments are displays that you can attach on top or bottom of another display of the same view.
- Click + Add on top of the view and select Attachment:
- Select Attach to: Page and and Attachment position: After:
Check the related tutorial on Header and Footer sections: http://www.wdtutorials.com/drupal/views/views-4-header-footer-page-setti...
Some things to notice with Attachments:
- You can only attach display to another display in the same view.
- You can inherit exposed filters.
- You can inherit pagers.
- Remove all but the image field from the display.
Now this Attachment display is showing below the Page display:
You can show a view as a block that can be displayed in different places like sidebars.
- Select the Attachment we created earlier and Duplicate it as a block:
- Change the format to Unformatted list and list only Titles:
In the Block Settings section you change some additional settings:
- Go to Structure > Block Layout and Place the block in the second sidebar:
Embed displays are intended to be used when embedding a view using code.
With Entity Reference display you can for example affect the results of an autocomplete reference field:
In this example we allow user only to reference his own articles.
- Create a new view and add an Entity Reference display to it.
- Add a title field to it and select the title for search in the Entity Reference list settings:
- Add Author relationship and select the user id as a contextual filter:
- Edit Basic page type and add an entity reference field:
- Edit the field and select our recently created entity reference display:
- Now when creating a basic page, user can only reference to his own articles:
Feed display transforms your view to an RSS feed.
There is already two examples at the views list so I'm not gonna reproduce them. You can just clone these views if you need some customised functionality:
One thing to notice here is that Drupal automatically creates feeds for taxonomy terms, with the view marked above.
Posted by Samuli Natri on 20 February 2016