Easily update your own collections

As site member viewing my own documentation collections, I would like to have the edit form for the collection available in a separate column. This is important since I almost always want to change the content of a collection when I visit my collection pages, and this feature would save me a click on the edit tab.

How to Demo: 
  1. Log in to the site with an account different from user 1. (Create an account if necessary.)
  2. Create a collection.
  3. When visiting the collection page, verify that you end up at a page displaying both the collection content and the edit form for the collection in separate columns.
  4. Log out. With a user account allowed to view and edit the collection, but different from the collection author, visit the collection page. (You could use the user 1 account.)
  5. Verify that the collection is displayed without any editing form.
Required Preparations: 
  • The site should have the documentation page and collection content types, as provided by the first exercises in this suite.
Additional Comments: 
  • There are several possible approaches to this user story. The suggested solution redirects to the edit page. A more natural approach would probably be to embed the edit form on the view page, but at the time of writing a bug makes this impossible.
  • In the redirect variant, it would make sense to also add the selection rule node: accessible to verify that the logged in user has access to edit the collection. Even if this is the case with the current site configuration, it may change in the future.
Downloads: 
AttachmentSize
2.69 KB
Suggested Solution: 
  1. Go to the overview page for Page manager. Enable the node/%node/edit page and add a new variant with the name editing own collection. Make it a panel variant, and check that you want to add both selection rules and contexts. (See managing custom pages in chapter 13.)
  2. As selection rule, add node: type and verify that the node being edited as a documentation collection. (See selection rules and variants.)
  3. In the context configuration, add the node author as a context by selecting user from node (on node.node_author) in the list for adding relationships. Call the new context object collection author. (See contextual objects.)
  4. In the panel layout configuration, select a two column layout. In the basic panel settings, just leave all settings to default values. (See layout and basic settings for the panel.)
  5. In the panel content configuration, add node content to the left column. Set all options to mimic the full node display. (See panel content.)
  6. In the right column, add the general form pane. (See panel content.)
  7. Let the custom page inherit the title from one of the panes. Edit both panes to override their titles with an empty text, as to not duplicate titles on the page. (See panel content.)
  8. Update and save the custom page. Now, with all context objects available, revisit the selection rules tab and add the criteria user: compare to verify that the logged in user is the same as the collection author. (See selection rules and variants.)
  9. In the Page manager overview, enable and edit the node/%node custom page.
  10. Add a new variant with the name redirect for editing own collections. Make it a HTTP response code variant, and check that you want to add both selection rules and contexts. (See managing custom pages.)
  11. Add the same selection rules and contexts as in the previous custom page – using the redirect only on collections, and adding the collection author as context.
  12. As response code, choose 301 redirect with the target node/%node:nid/edit. Update and save the custom page. (See configuring HTTP redirect response code pages.)
  13. Edit the selection rules again, and add the criteria that the logged in user must be the same as the collection author.
Solution Video: