Hello,

I really like the functionality this module offers but am encountering what I believe is a small bug.

To replicate it I've followed these steps:

  1. Create and publish new node with 'Save this edit as a draft' unchecked and the menu title 'title 1' as a top-level item in primary links.
  2. Edit the same node save with 'Save as a draft' and 'published' checked to create a draft that isn't live ( We have published checked by default so this is likely to happen).
  3. Edit the same node (this will I believe automatically be the same draft). The menu settings are blank so add the menu title 'title 2' as a top level item in primary links. Uncheck the 'Save this edit as a draft' checkbox and save the node.

The result for me is that two top level items exist in primary links pertaining to the same node. The 'Title 1' item can be deleted from within the menu system. The 'Title 2' item does not have a delete option alongside it on /admin/build/menu-customize/primary-links.

Please let me know if you require any additional information.

Many thanks.

CommentFileSizeAuthor
#1 menu_and_path-981924-1.patch2.36 KBdjac

Comments

djac’s picture

Title: Repeat menu item appears when saving draft to live state » Integration with the Menu System and Pathauto
Version: 6.x-1.0-beta2 » 6.x-1.x-dev
Status: Active » Needs review
Issue tags: +alias
StatusFileSize
new2.36 KB

Save As Draft creates a draft by saving a record to the node_revisions table. Essentially it is a node object with the same nid, but a new vid.

Regardless of whether or not the node is marked to be a draft, the menu item is updated. This is the issue. Furthermore, the path is also updated (if you're using Pathauto). The menu system and Pathauto do not keep track of the vid.

When editing a draft, the menu settings are blank as it attempts to load the node_revision (draft), which is disassociated from the menu item. Filling in the menu settings then creates a duplicate menu item which is associated with the node_revision (not the actual node). After coming out of draft mode, the original menu item is restored. This is very confusing.

Ideally, Save As Draft would manage changes to menu items or paths, but this could be a significant undertaking.

Instead I propose that Save As Draft does not allow users to modify the menu or path of a node while it is in a draft state.

Whether or not this is the right solution is up for debate, but I think it's a good starting point to avoid menu items and paths from being broken.