Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If you change the path, mgo breaks. Not cool.
Comment | File | Size | Author |
---|---|---|---|
#6 | menu_get_object_dx.patch | 2.87 KB | chx |
#2 | menu_get_object_dx.patch | 1.66 KB | chx |
menu_get_object_dx.patch | 1.49 KB | chx | |
Comments
Comment #2
chx CreditAttribution: chx commentedbah! Btw we could shorten to
if ($function == $target && !$count--)
but I am afraid of webchick's wrath to submit that :)Comment #4
chx CreditAttribution: chx commentedWell comment preview breaks because it uses menu_get_object to check for a node page but finds itself and thus breaks. That needs fixing. We probably want to add a router_path retriever so you can do menu_router_path_get() == 'node/%'.
Comment #5
pwolanin CreditAttribution: pwolanin commentedThis is some nastiness around %user_uid_optional vs %user that make this function mostly useless for non-node pages anyhow.
If our objects were not stdClass but something sensible, this function could happily return an object from a single load function and the receiver could change behavior based on the object class.
Anyhow - we need to better define what a 'node' page means - by many definitions the comment module behavior is broken. What it seems to want to know is whether the tab root is node/%
Comment #6
chx CreditAttribution: chx commentedFixed up comment module hopefully and also doxygen which was wrong as pwolanin points out with 'user'. I have fixed menu_get_object to work with user as it should: now specifying user also covers user_uid_optional. This addition made $target into an array which allowed me to use PHP array functions instead of that slow for-if construct.
Comment #8
RobLoachI've noticed that menu_get_item() doesn't retrieve the user object if you're on a user/% page. A menu_router_path_get() function would be helpful too so that you know what object you're getting from menu_get_object().
Comment #9
grendzy CreditAttribution: grendzy commentedI noticed this today to - menu_get_object('user') doesn't work on user/%.
Comment #10
chx CreditAttribution: chx commented