This documentation page also appears in...

As site visitor viewing a documentation page, I would like a list of all collections that include this page. If I am already browsing a collection, I only want other collections to be listed. This is important since it may help me find and use other collections, learning more about how to use the topics I am studying.

How to Demo: 
  1. Make sure there are at least three documentation pages available.
  2. Make sure that there are at least two documentation collections, and that there is at least one page they both refer to, and that they both have at least one page not referred to by another collection.
  3. Outside any collection context, view a documentation page included in more than one collection. Verify that there are links to the collections available on the documentation page.
  4. Verify that the links lead to the documentation page viewed in the context of the selected collection.
  5. Verify that any currently active selection is not present in the list of collections referring to the viewed page.
Required Preparations: 
  • The site should have the documentation page and collection content types, as provided by the first exercises in this suite.
  • The site should be able to display documentation pages in the context of a collection, as described in the previous two exercises.
Additional Comments: 
  • The user story doesn't tell how the collections should be listed – jump menu is one of several options. A plain HTML list would also work.
  • It could make sense to add a no results behavior to the view, saying there are no (other) collections referring to this page. However, it would be difficult to vary the the text depending on the page being viewed in the context of a collection or not – the (other) would be nice to exclude if there truly are no collections referring to the page.
Downloads: 
AttachmentSize
5.5 KB
Suggested Solution: 
  1. Create a new node view, named collections mentioning the viewed page. No sorting, filtering or displays are necessary at the quick-wizard page. (See creating new views in the Views basics chapter.)
  2. Add a contextual filter on the node reference field – filtering out all collections with a given value in their documentation page references. Verify that the contextual filter value is a node ID for a documentation page. Set the title override to collections mentioning this page. (See configuring contextual filters in the advanced Views configuration chapter.)
  3. Add another contextual filter on content: nid. Select Display all results for the specified field as the action to take when no filter value is present. (See managing missing filter values in the advanced Views configuration chapter.)
  4. Validate that the (second) filter value is a collection node ID. Set the title override to other collections mentioning this page. In the more settings, check the exclude option. (See configuring contextual filters in the advanced Views configuration chapter.)
  5. In the pager settings, set the view to display all results. (See pager in the Views basics chapter.)
  6. Add a view field content: nid. Exclude the field, and use the rewrite options to change it to node/[nid]/!1 – matching the path for viewing documentation pages in the context of a collection. (See rewriting view fields in the advanced Views configuration chapter.)
  7. Edit the title view field provided by default and disable the link option. (See editing view fields in the Views basics chapter.)
  8. Set the view format to jump menu. Use the rewritten node ID field as path. (See view formats in the Views basics chapter.)
  9. Add a content pane display. Set administrative title, description and category in a way that makes it easy to understand the pane in Panels. (See views content pane in chapter 13.)
  10. Set the argument input to from context for both contextual filters, and fetch content ID from a node object. Make the second contextual filter value optional. (See input of contextual filter values in views content panes, in chapter 13.)
  11. At the Page manager overview and the node/%node page, add a new variant for documentation pages. Have it display the viewed page and also the view pane with collections mentioning the page. Use the viewed page as the first contextual filter input, while leaving the second empty. (See panel content in chapter 13.)
  12. At the custom page displaying documentation pages in the context of a collection, also add the view pane. Use the page for the first contextual filter value, and the collection for the second one. (See panel content.)

Please note the additional solution video available for download – the video displayed above lacks at least one part of the solution.

Solution Video: