Create or Update a View¶
Overview¶
Views are powerful content filters that enable you to present Islandora (and other) content in interesting and exciting ways. For more documentation on views:
Before you start¶
- The following How-To assumes that you are using the (optional) Islandora Starter Site configuration. This configuration is deployed automatically if you build your Islandora site using the Ansible Playbook, ISLE, or are using the sandbox or a Virtual Machine Image
- This How-To assumes familiarity with Drupal terms such as Node, Content Type, and Media.
How to modify an existing view¶
Islandora Starter Site ships with some views already created and turned on. The Islandora home page displays content items that have been added to Islandora. This view is named Frontpage, and it lists items that meet the following filter criteria:
- The item is in the published state.
- The checkbox Promoted to front page is selected.
This view will display all content items added to Islandora, as the checkbox Promoted to front page is on by default.
As you develop your Islandora Website it is likely that you will need to change the default behaviour of the Frontpage View. As an example, the following describes how to edit the Frontpage page view to only show content items and not collections.
For this example, we added six collection items to Islandora. In total there are eight items in the repository. In addition to the six collection items, there is one audio item and one image item.
- Using your Web browser, open the Islandora front page.
-
To edit the front page view, hover over the view (Frontpage view) and select Edit view when displayed.
-
Select Add under the filter criteria section.
-
We do not want to display collections, so we need to add a filter criteria that does not filter for the Islandora model type 'Collection'.
-
Select Model from the list and then Apply (all displays).
-
Select Islandora Model to select filters on Islandora model types and select Apply and continue.
-
Select the operator Is none of and the Collection model (autocomplete should work here to help you). To finish click Apply (all displays).
-
Save the view. Now the 'Frontpage' View does not display collections.
-
How to create a new view¶
For this example, we create a new view that only shows collections. It will be created as a Block (also see the tutorial on Configuring Blocks) that will only display on the front page. We will add the new collection list block below the existing frontpage view that lists items.
- Using your Web browser, open the Islandora front page
- Navigate to Administration >> Structure >> Views
- Create a new view by selecting Add view
-
Name the view and select Create a block. Give the block a title and decide how you want it to display (Grid, Table, List, Paging). To progress, select Save and edit.
5. Customize the view format and sorting as required. 6. Add a filter criteria to only show the Islandora model type of 'Collection' and Save the view.
7. To place the view on front page, the new block must be added to the 'Main page content' area (using 'Block layout') and set to display on the front page. 1. Navigate to Administration >> Structure >> Block layout (/admin/structure/block). Under Main content select Place block
![Frontpage view collection list place block](../assets/frontpage_view_collection_list_place_block.png)
- Find the new block, 'Collection List' and select Place block.
-
Restrict the block to only display on the frontpage by adding the text '
' to the Page vertical tab. Then select Save block. 4. Review the block placement and move if required.
8. The 'Collection list' now only displays on the front page. It displays below the Main page content.
Islandora Quick Lessons
Learn more with videos on Basic Views and Advanced Views.