Is anyone else experiencing this? Is there a work around? I have a content type assigned to a container "projects" which has a number of categories, all the menu items for the categories show up OK. I have the container configured to generate menu items for nodes of the assigned content type but no links are showing up.
Breadcrumbs are showing up correctly. The "Menu" option is removed from the create new node page, so I'm assuming that is because category is supposed to be overriding it but the menu links are not showing up / being created. I see the menu links for the categories in the database but there is no trace of the actual node menu links in the database. (checking in the menu_links table)
I searched but have not found any patches or hints about resolving this issue.
help please
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | category-menu-names.patch | 2.16 KB | JirkaRybka |
Comments
Comment #1
internets commentedI also noticed that when changing settings and trying different content types to see if anything would get the node menu links to show up, the checkbox under "Generate menu links for assigned content: " are suddenly unchecked.
Does there need to be a field in the category_menu table for "links_for_nodes" similar to "links_for_cats"?
I tried simply adding a "links_for_nodes" field but that did not seem to have any effect. I also tried assigning a default content type "page" to a container, then assigned it to a category but it did not appear in the menu. There does not appear to be menu_links being created for nodes.
Comment #2
JirkaRybka commentedYes, I confirm that links for nodes are broken. They get saved to an entirely wrong menu - i.e. instead of "navigation" (assume I've selected that) it saves into a menu named "story" (i.e. content type name!), which doesn't show anywhere.
I'm working on a patch right now.
Comment #3
JirkaRybka commentedOk, now I have a patch (internets, try it, it should work - it would be nice if you report back here in any case).
The problem is indeed with menu names: All the links are actually saved to menu system already, but they are almost all saved into wrong menus:
- Visible category and container links: Into selected menu (that's OK)
- Visible node links: Into invisible/wrong menu named by content type (clearly a bug!)
- All invisible links: Into menu 'category-menu-toc-' (code attempts to append container ID to that, but fails - so this is broken too!)
My patch fixes this by correcting the arguments given to category_menu_menu_name(), also adding a second argument to pass the needed $cnid in. (It might be possible to pass just whole $container_settings, or even remove the function altogether, as it seems to be never used outside this part of code, but I aimed for the change to be minimal here.)
Also the category_menu_menu_name() call is centralized to one place for both nodes and categories/containers, as it's the same for both cases after the fix (plus removed one completely unused $container_id variable).
Then, one comment clarification - took me a while to understand, so improving for others to get the point faster.
Also, only after analyzing the code a bit, I understood some limitations, which need to be documented somewhere (the above-mentioned confusing behavior of container settings of content types for menu falls to this realm, most probably, too):
- Each content type may be "owned" by only one container at the same time (after a while of thinking, this is obvious, as you can only have one menu item per path/node without running into all sorts of funny problems). So edit of one container is able to "uncheck boxes" on another container, when it comes to menu links for nodes.
- (only answering the initial post - not really for documentation: Node type settings are, unlike category settings, held in Drupal's variables, rather than the category_menu table.)
- Comments in code indicate further cases, when menu links for nodes are NOT generated (by design):
Note that this is the patched version, otherwise the fourth condition said to only have one category on the node - fortunately that only applies to the container with menu links enabled. Additional categories from other containers are no problem.
Comment #4
internets commentedAwesome,
Thanks for the detailed problem and solution description. I applied the patch and it appears to be working correctly now. I had to go through the menu config for the container, check the box for generate menu links for nodes. Re-saved my nodes that were assigned and the links are now showing up.
Comment #5
JirkaRybka commentedI don't see why you reverted the issue status etc., but perhaps it was unintentional - I once saw it myself, that this info got changed on preview or something... Now changing the status again, so that it may be properly recognized by the maintainer, and fixed in the official Category code. Only after the patch gets inside, will this be fixed - this is not just a support request, there's a serious bug discovered.
Since #4 confirmed the fix to be working, setting RTBC (patch at #3).
Comment #6
Jaza commentedCommitted to HEAD. Thanks.
I vaguely remember fixing this problem on one of my sites, in pretty much exactly the same way.. I forgot to commit that fix back (very naughty of me). So, thanks for the patch - it was overdue!