There seems to be some issues with aggregator menus. Using paths:
aggregatorshows a list of posts with the title "news aggregator" and breadcrumbs (bc) limited to "Home", no local tasksaggregator/categoriesshows a list of categories and their most recent posts, with bcHome > news aggregatoraggregator/categories/<cid>shows a visually identical list of posts with the same title as in (1), the same bc as in (2), and local tasks, but no title or mention in the bc about the current category
This seems inconsistent: it seems that
- (1) should have the local tasks
- (2) is correct
- (3) should have bc including a link to level (2) and a title containing the current category
Otherwise we're missing consistency.
Note: this is carried over from http://drupal.org/node/172835
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | aggregator_menu_1202855472388.png | 46.29 KB | mcsnolte |
| #26 | menu_link_maintain.patch | 905 bytes | chx |
| #25 | aggregator_menu-173188-25.patch | 4.04 KB | gábor hojtsy |
| #24 | aggregator_menu-173188-24.patch | 3.54 KB | chx |
| #22 | aggregator_menu-173188-22.patch | 4 KB | JirkaRybka |
Comments
Comment #1
chx commentedThis little patch might help one of your cases. Also apply please http://drupal.org/node/172754 it might help some others if not, please patch.
Comment #2
fgmI did some additional fixing for (3). The suggested patch combines this with the previous patch.
However... I'm under the impression that the new menu system might have made this change unnecessary:
Couldn't it be replaced by some additional parameters in
aggregator_menu?I did not define the local tasks at
aggregatorbecause I'm not sure what they should be:View | Categorize | Configure? But if so, this might be disturbing for users to find the same tasks at two difference levels, and not applying to the exact same selection of news items.Comment #3
chx commentedI would say let's do what D5 does. My patch strives to get there.
Comment #4
fgmIn that case, it should be
drupal_set_title($category['title']);instead ofdrupal_set_title($category['description']);Modified patch accordingly.
Comment #5
chx commentedosinet, I have problems with your patch. I have rerolled mine with your
drupal_set_breadcrumbcall, but I do not see what else have you changed. Thedrupal_set_titleinaggregator_page_categoryhas the wrong index and also, there is atitle callbackto set up the title so why do you need adrupal_set_title?Comment #6
pwolanin commentedsubscribe
Comment #7
fgmYou're right to have a problem with my version: the
menu_set_titlewasn't needed after all, it seems. The only other changes were thedrupal_set_breadcrumbsand some reordering inaggregator_menuto make the source more easily readable (ordering menu definitions for foo, foo/bar/baz, and foo/bar/baz, and foo/bar/baz/qux in that order instead of having them unordered and interspersed with other paths.Your version is good for me. RFCR.
Comment #8
chx commentedMy aggregator cleanup from a time ago caused this -- I was aware of the problem so I have readded the menu links in here but the issue title is nowhere near appropriate, the breadcrumb fix is a minor fix compared to the rest of the patch.
Comment #9
gábor hojtsyWhy, oh why do we need to fiddle in the menu table in aggregator module?
Comment #10
chx commentedAs promised in the menu comment if this gets in, i will love a bit node_menu too.
Comment #11
chx commentedLet me mention this is does not simply restore the category menu but by moving from router to links, it will scale easily to hundreds or thosuands of feeds.
Comment #12
chx commentedhuh i has written ['cid'] in the delete instead of ['mlid']
Comment #13
chx commentedThis is much cleaner: we use the module field.
Comment #14
pwolanin commentedtypo in the code comment here: "Get an link by its path and the hadnling module."
also, would it not make more sense to call it function menu_link_load_by_path rather than function() menu_link_load_by_module() since module is an optional parameter?
Comment #15
catchthis fixes the typo. Also added a full stop at the end of another comment. Don't credit etc.
Comment #16
chx commentedYour patch did not apply. I have rolled from mine. To clarify, I simply removed the module default. There is no point in menu_link_load_by_path as the return of such a thing can not be defined because a path does not define a menu link, one path can have many links. Adding a module constraint makes it meaningful.
Comment #17
pwolanin commented@chx - the result may still not be unique, even with the module constraint. Also, since we only want one result, it may be better to use db_query_range(). Also, we may not want to use m.*, since some fields in {menu_links} and {menu_router} have the same name. I think with MySQL the below may work correctly (i.e. the ml. fields clobber the m. fields, but that may be db-specific - is there an ANSI SQL standard for this issue?)
Actually - this is probably something that needs to get fixed in menu_link_load() as well (so maybe this code is my fault). I think the code here is more correct: http://api.drupal.org/api/function/menu_tree_page_data/6
something like:
Comment #18
chx commented"Menu system is cool", Episode N: "do what I mean" featuring menu_link_maintain. Just does what needs to be done.
Comment #19
dmitrig01 commentedShouldn't link_title be lowercase?
Comment #20
chx commentedOf course it needs to be and what stopped you from fixing the patch -- you surely had the time if you had the time to discover such an earth shattering bug :/ if I am not here after hours then this would have held up the patch totally absolutely needlessly.
Comment #21
dwwCode in #20 mostly looks fine to me. I didn't try testing it, but it's clear and well-documented. 1 tiny nit-picking problem: "uncostumized" is a typo in a phpdoc comment. No time to re-roll myself, and it's not worth setting this to CNW over a typo in a comment. menu_link_maintain() looks like a nice improvement. Other than the typo, and oh, yeah, testing it, ;) I'd mark this RTBC...
Comment #22
JirkaRybka commentedI just grabbed a text-editor and edited the previous patch file for that typo in #21...
Comment #23
chx commentedI am setting this to RTBC -- I know it works and I am fairly sure the core commiters will like the "do what I mean" approach.
Comment #24
chx commentedFurther testing revealed a notice thrown on delete.
Comment #25
gábor hojtsyOK, fixed the phpdoc for the menu link maintain function.
Before:
After:
"This function" was pointless. We never tell something to the developer (ie. your module) and maintain was already in the function name, so it was not helpful. There was a typo in the op list and the link title missed explanation on how it is actually used. Now committed this patch.
Comment #26
chx commentedThis is an absolute no brainer.
Comment #27
dwwAgreed. +1 on the basic change.
Not sure how i feel about
return; break;right after each other like that.+ the break is more consistent and defends us from a bug in the future if someone re-factors where the return happens
- the break isn't necessary as it currently stands
In the interest of defensive programming, I'm happy to leave it how it is, so I'm not changing this from RTBC, but I wanted to at least raise the point. Not sure if there's existing precedent in core on how to handle this.
Thanks for continuing to make Drupal better, chx. ;)
Comment #28
gábor hojtsyI think having the break there is good for code cleanliness and consistency. So committed.
Comment #29
(not verified) commentedComment #30
mcsnolte commentedThe addition of "drupal_set_breadcrumb" in "modules/aggregator/aggregator.pages.inc" seems to possibly mess up the breadcrumbing.
See attached screen shot of "Categories" being duplicated.