Go to node/x/edit - the breadcrumb is Home >> View which is not not nice - the node title should be there instead of View. We can fix this easily enough using a title callback.

The user, filter and taxonomy modules may have the same problem, so leaving this as CNW until I check them too.

Note - force a menu rebuild since this patch changes hook_menu.

Comments

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new4.48 KB

oh dear - that's all wrong - if you make links to nodes this break in all sorts of bad ways (in part because we avoid loading the every node for performance reasons). So, maybe not readily fixable for nodes, except this patch changes the title to 'Content' from 'View' which looks a little better.

Currently we have a problem for user module - on the user edit page (for any user - not just the current) the BC is: Home >> My account. Attached patch fixes this, but the downside is that all links to user accounts (link 'user/2') consisting only of the user name. As a work-around you can link to 'ser/2/view'.

Also fixes the BC/titles for the filter pages.

pwolanin’s picture

StatusFileSize
new4.46 KB

minor re-roll - webernet noticed a double period in one comment.

pwolanin’s picture

StatusFileSize
new4.5 KB

re-roll to remove offset/fuzz

robloach’s picture

Status: Needs review » Needs work

If you don't like the "View" terminology (you suggested "Content" instead), I'd suggest either translating it yourself or using something like String Overrides. The other stuff in here is pretty good though...

pwolanin’s picture

Status: Needs work » Needs review

@Rob Loach - the issue is with what appears in the breadcrumb on the node edit screen. Does "View" really makes sense as the parent of "Edit"?

robloach’s picture

StatusFileSize
new4.85 KB

What if we did the same thing you did for the users (title callback) for the nodes as well....

pwolanin’s picture

Status: Needs review » Needs work

@rob - I tried that approach earlier - it's bad for the reason that the title callback overrides whatever title you set if you make a link to the node in the a menu. This isn't as bad with users, but still maybe a reason to not do it.

robloach’s picture

I see three things we're attempting to fix here:

Input Formats
In admin/settings/filters/1/configure and admin/settings/filters/1/order, you see "Home › Administer › Site configuration › Input formats ›" when it would be assumed you'd see "Home › Administer › Site configuration › Input formats › %FilterName%".
User Accounts
When editing other people's accounts (or tracking other people's accounts), you see "Home › My account". Seeing how you're not editing your own account, it would be wise to display "Home › %Username%".
Node Editing
When editing a node (or visiting other tabs like Dev Render), for the breadcrumb, you see "Home › View". It would make more sense to display "Home › %NodeTitle%".
robloach’s picture

Title: ugly breadcrumbs on node edit and other pages » Ugly Breadcrumbs

Also just found:

Menu Editing
If you edit one of the menus at admin/build/menu and click on "Add item" or "Edit menu", you get "Home › Administer › Site building › %MenuName%", when you'd expect "Home › Administer › Site building › Menus › %MenuName%".

Think we should break these up into separate issues?

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new5.96 KB

the more I play with this the less happy I become about non-t() title callbacks being applied to link titles aside from BC and page title use.

thus, attached patch tries a somewhat new direction

robloach’s picture

Found another:

Edit Previewing Nodes
When you edit a node and then hit preview, you get "Home › Create content › Submit %NodeType%", when you'd expect "Home › %NodeTitle%".
chx’s picture

Status: Needs review » Reviewed & tested by the community

At first I got a bit concerned about security but then this is how title gets set in drupal_get_title

    $title = check_plain(menu_get_active_title());

that's safe. As for the changes, they are fine.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Some noted:

Menus:
- right the first line is a bad whitespace change
- why didn't we need the elseif($callback) check before?
- you removed(?) the special case for t() title callbacks which was supposed to be a performance improvement originally

Filter formats:
- this looks good

Nodes:
- we use verbs for tab titles where possible, so "Content" as a tab title does not look fitting into the concept

Users:
- that %user_current looked more and more suspicious through different patches... so why is it called the %user_current, if it matches any users?

pwolanin’s picture

@Gabor: %user_current could be something else, but the reason it has that name is that it is one of the few items to use a _to_arg() function so that the link in the navigation menu points to the current user's account.

pwolanin’s picture

@Gabor - also if we went with 'Content' as a title for the node page it does not show on the tab (that is still 'View') - 'Content' would only show in the breadcrumb. For example, on node/x/edit the typical BC would be Home >> Content rather than the current Home >> View

pwolanin’s picture

Also - is it a feature or a bug that some page titles can be change by changing a link title in the Navigation menu?

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new6.31 KB

ok - I'm happier with this now - I think it makes sense. Now no user-specified link title will ever be overwritten by the title callback, when the link is rendered in the menu block. However, for the active trail, a non-t() title callback will still be applied.

pwolanin’s picture

anyone taking a look at this? It's not critical, but I think it's a definite bug

pwolanin’s picture

StatusFileSize
new5.93 KB

minor re-roll - webernet pointed out a stray space in front of function _menu_item_localize

robloach’s picture

StatusFileSize
new6.25 KB

Nice work, everything seems to display properly. This attached patch also fixes the Node Previews that I mentioned earlier.

moshe weitzman’s picture

Can we get a review and RTBC in here? /me runs away ...

moshe weitzman’s picture

And perhaps someone like pwolanin can comment on related issue: http://drupal.org/node/170309

robloach’s picture

Here are some steps that one can take to review this patch:

  1. Fresh Drupal install
  2. Generate some users and visit user/2/edit and note the ugly breadcrumb
  3. Create a node and edit it, note the ugly breadcrumb
  4. Create a node and preview it, note the ugly breadcrumb
  5. Apply the patch and repeat the previous 3 steps, noting the pretty breadcrumbs
  6. Mark patch RTBC
pancho’s picture

Status: Needs review » Reviewed & tested by the community

Breadcrumbs before patch:

  • on user/2/edit: Home › My account
  • on node/1/edit: Home › View
  • on node/add/story (Preview): Home › Create content › Submit Story

> Applied patch
> Rebuilt menus

Breadcrumbs after patch:

  • on user/2/edit: Home › Foo (for user "Foo")
  • on node/1/edit: Home › Bar (for node "Bar")
  • on node/add/story (Preview): Home › Create content

I set this to RTBC, as the patch apparently does exactly what is was supposed to do. Good job!

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Needs review

OK, I looked over #20 and do not understand how/why the call to _menu_item_localize() gets removed, and replaced with some code which does less. It does not ensure that the menu item descriptions are localized for example. Can someone enlighten me? Also, nobody explained why didn't we need the elseif($callback) check before, although I asked this above.

pwolanin’s picture

@Gabor - the elseif is extra insurance - I think there could be some items with empty callbacks.

_menu_item_localize() is removed at that point because it will overwrite a user-entered title for a link. Instead - only t() is called to actually localize the title if it matches the title of the router item. As far as I know, all other title callbacks are not actually localizing, but are rather generating the title based on the path or some such.

I don't think the description is ever localized - they are added to the options array. I suppose we could use the same sort of check as for the title - whether it matches the router item value.

gábor hojtsy’s picture

Status: Needs review » Needs work

pwolanin: descriptions are written in English in code, and stored in English in the database. Look into what _menu_item_localize() does. It does localize the description too, so without using it, we basically loose menu item description localization at least.

pwolanin’s picture

@Gabor - $item['description'] is only used, as far as I know, for a few admin pages. In this case, since we are displaying a link, the description is not used at all. It would be easy enough to add a line to localize it, just in case, but is there any reason to?

I think it is a separate bug that the title attribute will not get localized. This attribute is derived from the description when the link is saved to the DB

includes/menu.inc:1566: 'options' => empty($item['description']) ? array() : array('attributes' => array('title' => $item['description'])),

gábor hojtsy’s picture

Hm, so it seems I unknowingly touched on another bug :) Anyway, all I was saying is that _menu_item_localize() does more then what you do here. One thing it does it it t()-es the item description. Whether the menu item description is used or not depends entirely on the theme, right? That Drupal core itself does not display it does not mean a theme would not.

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new9.05 KB

@Gabor - after investigating - apparently we weren't even loading the description onto the menu links.

Improved patch now does that and also localizes it and the title attribute (using the same test as for link title - localize it if it matches the router item)

pwolanin’s picture

Title: Ugly Breadcrumbs » Enable Localization of Link Title Attribute and Fix Ugly Breadcrumbs
webernet’s picture

Did some basic testing and all seems OK.

kkaefer’s picture

Applied the patch and confirmed that it fixes the missing title/descriptions issue.

robloach’s picture

Status: Needs review » Reviewed & tested by the community
dries’s picture

Status: Reviewed & tested by the community » Fixed

To me, this isn't 100% either. In case of editing a node, I'd expect the page is always the title of the node and not 'Edit $title'. We don't use 'Edit $username' either. I've made that change and committed the patch. Thanks all.

webernet’s picture

Status: Fixed » Reviewed & tested by the community

The commit ( http://drupal.org/cvs?commit=92964 ) was incomplete -- only the node.module and node.pages.inc chunks were committed.

robloach’s picture

Status: Reviewed & tested by the community » Needs work

I believe we should make a new patch reflecting the part(s) that were missing.

pwolanin’s picture

Assigned: Unassigned » pwolanin
Status: Needs work » Reviewed & tested by the community
StatusFileSize
new8.05 KB

Here's a re-rolled patch with the missing parts - It seems Dries intent was to have just the node title (absent the word "Edit"), so I fixed that line too. With the present HEAD there is no title at all on the edit page.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.