For a project url:
http://drupal.org/project/issues/3270

The breadcrumb is: Home >> Downloads

Comments

killes@www.drop.org’s picture

Project: Drupal.org site moderators » Project
Version: » x.y.z
Component: web site » Projects

moving

nedjo’s picture

Well, I'm not sure. The term 'downloads' doesn't appear anywhere in the project module code (except for some css selectors). There seems to be some drupal.org customization here.

dww’s picture

it's not the "downloads" part that wrong with the breadcrumb (IMHO). i agree, that's some funky drupal.org customization i don't fully grok, but that's not the issue as i see it. even on a local test site, if you go to view the issue queue for a specific project, i'd expect the breadcrumb to be:

home - projects - (project taxonomy term) - project name

if you start at a project homepage:

http://drupal.org/project/project

the breadcrumb is:

home - projects - (project taxonomy term)

once you click on "view all issues" (or something) and goto the issue queue for the project, i'd expect the full breadcumb with the project itself in there, but instead, you just get:

home - projects

that really does seem like a (minor) bug, independent of the slightly confusing "downloads" vs. "projects" stuff on drupal.org.

-derek

aclight’s picture

Version: x.y.z » 5.x-1.x-dev
Assigned: Unassigned » aclight
Status: Active » Needs review
StatusFileSize
new1.56 KB

Here's a patch that fixes the problem. See http://drupal.org/node/152789 for reasoning behind the patch.

AC

dww’s picture

Priority: Minor » Normal
Status: Needs review » Fixed

Reviewed, tested, and committed to HEAD, DRUPAL-4-7--2 and DRUPAL-4-7. Thanks!!!

aclight’s picture

Title: breadcrumb wrong for projects » fixing breadcrumbs in project module
Status: Fixed » Needs review
StatusFileSize
new1.86 KB

There are some additional places in project* where breadcrumbs aren't set right, such as

  • On the node/add/project_release page
  • On the node/X/edit page where X is a node of type project_release
  • On the node/X/edit page and node/X/edit/releases page where X is a node of type project_project

The attached patch fixes these issues.
AC

aclight’s picture

StatusFileSize
new1.46 KB

Hm.....

Maybe my patch in comment #6 was a little overly aggressive.

Specifically,

  • On the node/X/edit page and node/X/edit/releases page where X is a node of type project_project

probably shouldn't be changed.

The attached patch keeps the first 2 changes in #6 but drops the last one.

If by chance you like #6 better, project_issue_project_edit_issues() in project_issue.module also needs to be changed so that the call to breadcrumb is:

  project_project_set_breadcrumb($node, TRUE);

AC

drewish’s picture

humm... i don't know if this does it: the following paths gave the following breadcrumbs:
node/*/edit
Home › Downloads › Modules
node/*/edit/issues
Home › Downloads › Modules
node/*/edit/releases
Home › Downloads › Modules › PROJECT
shouldn't issues and releases match?

also, probably unrelated, but i was getting the following warning on node/*/edit/releases:

warning: array_merge() [function.array-merge]: Argument #1 is not an array in modules/project/release/project_release.module on line 1255.
aclight’s picture

I'll look into the first part of your question later.

also, probably unrelated, but i was getting the following warning on node/*/edit/releases:
warning: array_merge() [function.array-merge]: Argument #1 is not an array in modules/project/release/project_release.module on line 1255.

I think you're seeing what's been reported at http://drupal.org/node/145755

AC

aclight’s picture

@drewish:

humm... i don't know if this does it: the following paths gave the following breadcrumbs:
node/*/edit
Home › Downloads › Modules
node/*/edit/issues
Home › Downloads › Modules
node/*/edit/releases
Home › Downloads › Modules › PROJECT
shouldn't issues and releases match?

On my test site, I get the following:
node/*/edit
Home › Downloads › Modules
node/*/edit/issues
Home › Downloads › Modules
node/*/edit/releases
Home › Downloads › Modules

Which patch were you using? I think #7 provides the most consistent behavior. If that's what you're using, then it's possible my patch doesn't include all the changes I made. Let me know if you're using #7 and getting the behavior you described above and I'll try to figure out why we're getting different results.

AC

drewish’s picture

yeah, i was using #7.

aclight’s picture

If you're using the patch in #7 and the most recent version of project.inc, and project_release.module, I don't see how you can be getting what you describe.

Here are where the breadcrumb is set in each of the 3 tabs when editing a project_project node:

  • Project: project_project_form() function in project.inc
  • Issues: project_issue_project_edit_issues() function in project_issue.module
  • Releases: project_release_project_edit_releases() function in project_release.module

In each case, the breadcrumb is set by calling project_project_set_breadcrumb($node).

project_project_set_breadcrumb($node) looks like this:

function project_project_set_breadcrumb($node = NULL, $extra = NULL) {
  global $_menu;
  $breadcrumb = array();
  $breadcrumb[] = l(t('Home'), NULL);

  // Find out if the site has created a menu name for /project and use that
  $pid = $_menu['path index']['project'];
  $name = $_menu['items'][$pid]['title'];
  $breadcrumb[] = l($name, 'project', array('title' => t('Browse projects')));

  if (!empty($node) && project_use_taxonomy()) {
    $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid INNER JOIN {term_node} r ON t.tid = r.tid WHERE h.parent = 0 AND t.vid = %d AND r.nid = %d', 't', 'tid'), _project_get_vid(), $node->nid);
    $term = db_fetch_object($result);
    $breadcrumb[] = l($term->name, 'project/'. $term->name);
  }

  if (is_array($extra)) {
    $breadcrumb = array_merge($breadcrumb, $extra);
  }
  elseif ($extra && !empty($node)) {
    $breadcrumb[] = l($node->title, 'node/'. $node->nid);
  }
 
  drupal_set_breadcrumb($breadcrumb);
}

As you can see, if $extra is undefined (as is the case in each of the 3 edit subtabs of a project), then the project title should NOT be added to the breadcrumb.

You might try changing the call from project_project_set_breadcrumb($node) to project_project_set_breadcrumb($node, FALSE) though I don't see why that should change the behavior.

So I can't explain why you're seeing the breadcrumbs you are seeing. Like I said before, I'm seeing them as expected.

AC

dww’s picture

Status: Needs review » Fixed

#7 is in fact broken as drewish describes, due to this hunk of the patch:

@@ -1150,7 +1155,7 @@ function project_release_alter_project_f
  */
 function project_release_project_edit_releases() {
   $node = node_load(arg(1));
-  project_project_set_breadcrumb($node);
+  project_project_set_breadcrumb($node, TRUE);
   drupal_set_title(check_plain($node->title));
   return drupal_get_form('project_release_project_edit_form', $node);
 }

After removing that hunk, this is a winner. Tested and committed to HEAD and DRUAPL-4-7--2.

Thanks!
-Derek

aclight’s picture

Ah.....I guess my production version wasn't in sync with the version I used to make the patch.

Sorry for the confusion!

Anonymous’s picture

Status: Fixed » Closed (fixed)