Nodes now don't need to call taxonomy_node_get_terms() to access terms, as the array of terms is already available in the $node->taxonomy property.

Attached patch cleans up unneeded calls.

Comments

dries’s picture

Is that 'taxonomy[0]' guaranteed to be correct? Are we sure it can never be 'taxonomy[1]'? Otherwise looks good to me.

dww’s picture

Title: Use new $node->taxonomy array » Use project_project_set_breadcrumbs() instead of taxonomy_node_get_terms()
Project: Project » Project issue tracking
Version: x.y.z » 5.x-2.x-dev
Component: Projects » User interface
Priority: Critical » Normal
Status: Needs review » Needs work

Doesn't apply anymore. Furthermore, there's a new helper method to get this right, project_project_set_breadcrumbs(). The only occurances of this problem are now to be found in project_issue.module's issue.inc, so moving this over to the right queue.

hunmonk’s picture

Status: Needs work » Needs review

taking a crack at this one. not sure if i've used the new function totally correctly or not. needs testing.

hunmonk’s picture

StatusFileSize
new2.34 KB

and the patch

dww’s picture

Status: Needs review » Needs work

mostly looks good on visual inspection, but i don't understand why you modified project_project_set_breadcrumb() to return the breadcrumb array, too. can you either remove that from the patch or explain why you did it? thanks!

ChrisKennedy’s picture

The project_issues_statistics() change was fixed by Derek at http://drupal.org/node/185378 but should the second change still be made?

Regarding #5, the breadcrumb apparently needs to be returned because on the next line it is used in menu_set_location.

dww’s picture

menu_set_location() shouldn't be used at all, i didn't notice that in the initial patch. drupal_set_breadcrumb() is vastly superior, and lo, that's what project_project_set_breadcrumb() does. ;) So:

A) The change to return the breadcrumb array should be removed from this patch
B) The call to menu_set_location() should also be removed.

Whoops about #185378, which was sort of duplicate with this. ;) I kinda remember this issue existing, but I couldn't find it the other night when I submitted 185378... oh well. We can still clean up project_issue_view() in here.

hunmonk’s picture

Title: Use project_project_set_breadcrumbs() instead of taxonomy_node_get_terms() » clean up inconsistent breadcrumbs for issues/issue followups
Assigned: Unassigned » hunmonk
Category: task » bug
Status: Needs work » Needs review
StatusFileSize
new3.43 KB

attached cleans up project_issue_view(), and also the breadcrumb trail at /comment/reply for project issues.

each of the respective functions that the breadcrumb code is in can be called from either a main issue or from a comment reply (the comment reply form can appear on the issue page, and project_view() is called to display the issue preview below a comment followup), so i've iimplemented a helper function which checks for which kind of page we're on, and sets the trail appropriately.

dww’s picture

Status: Needs review » Reviewed & tested by the community

lovely. code is good (though i'd prefer a final newline after the closing } for project_issue_set_breadcrumb()). tested both with the comment form displaying under the issue node, and on a separate page. works beautifully. thanks.

hunmonk’s picture

Version: 5.x-2.x-dev » 5.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

fixed in HEAD. if we want this to go into older versions, the patch must be re-rolled

hunmonk’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new4.02 KB

patch for 5.x-1.x -- i don't have a 5.x-1.x install handy, can somebody test this for me?

hunmonk’s picture

Version: 5.x-1.x-dev » 5.x-2.x-dev
Status: Needs review » Fixed

tested, and committed to 5.x-1.x.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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