View documentation pages in collection context

As site builder, I would like to be able to know which collection is currently active – if any – when a user views a documentation page. I want this implemented by being able to display documentation pages at URLs on the form node/[collection-nid]/[docspage-nid]. This is important since it allows further enhancements on the site, displaying documentation pages within the context of a collection. Note that this not a real user story, as it doesn't provide any value to end users of the site. It should rather be a development task within a user story.

How to Demo: 
  1. Log in to the site.
  2. Create a documentation page. Remember its node ID.
  3. Create a documentation collection, including the new documentation page. Remember its node ID.
  4. Manually enter the URL on the form node/[collection-nid]/[docspage-nid]. Verify that the documentation page is displayed.
  5. Alter the URL and replace the documentation page node ID with a string or a number not corresponding to a documentation page node ID. Verify that you are given a “404 page not found” response.
  6. Alter the URL to replace the collection node ID with a string or a number not corresponding to a collection node ID. Verify that you are given a “404 page not found” response.
Required Preparations: 
  • The site should have a news article content type, as provided by the first exercise in this suite.
Additional Comments: 
  • If there is access control on the documentation collection, it makes sense to also disallow viewing documentation pages within that context. It also makes sense to add access control on the documentation page, to assure that the acting user may view it. (Page manager won't display nodes that a user isn't allowed to access, but explicitly verifying the access makes it possible to have custom reactions.)
  • It would definitely make sense to verify that the viewed documentation page actually is included in the active collection. However, this requires conditions not natively supported by CTools. If installing the Rules Bonus Pack module, Page manager may use Rules components to check conditions – drastically increasing the possibilities for access control.
  • To make the viewer more aware of the collection she is browsing, a custom pane could be added above the documentation page, saying You are currently browsing the %collection:title collection.
Downloads: 
AttachmentSize
2.6 KB
Suggested Solution: 
  1. Go to the Page manager overview and add a new custom page. Call it documentation page within a collection, give it the path node/%collection/%docspage and check that you want to have selection rules. Make it a panel variant. (See managing custom pages in chapter 13.)
  2. In the argument configuration, set both %collection and %docspage to be interpreted as node IDs, and give them the labels collection and documentation page. (See argument settings.)
  3. In the selection rules configuration, add conditions to check that the collection and documentation page correspond to the expected node types. (See selection rules and variants.)
  4. Chose the single column layout. Leave the basic panel configuration as it is. (See panels configuration.)
  5. In the panel content, add node content and have the settings mimic a standard node display. Override the title with an empty string, and instead let the panel variant as a whole display the title, inherited from the pane. (See panel content.)
Solution Video: