http://api.drupal.org/api/function/hook_view/6
menu_set_location
The above mentioned function should be changed.
menu_set_location is not supporting in Drupal 6.

Regards.

CommentFileSizeAuthor
#5 668650_nospace.patch1010 bytesjhodgdon
#3 668650.patch1011 bytesjhodgdon
#2 668650.patch1011 bytesjhodgdon

Comments

jhodgdon’s picture

Title: Documentation problem with Reply to comment » hook_view() example uses function that doesn't exist
Version: 6.x-dev » 7.x-dev

Good point! The example for hook_view() in both D6 and D7 uses the menu_set_location() function, which does not exist.
http://api.drupal.org/api/function/hook_view/7

Should be fixed in D7, then ported back to D6.

jhodgdon’s picture

StatusFileSize
new1011 bytes

Looking at the doc for the old menu_set_location() function in Drupal 5, as well as the current example for hook_view() (which is also left over from Drupal 5, sheesh!), it looks like the main purpose is to set the breadcrumb trail. So in D6/D7, I think it should be using drupal_set_breadcrumb().

Which means the array is a bit different as input to drupal_set_breadcrumb() as opposed to menu_set_location(). Also, http://api.drupal.org/api/function/drupal_set_breadcrumb/7 wants the array to start with Home and not to include the current page.

So I've rewritten the sample function body... needs a review, then can be ported to Drupal 6.

jhodgdon’s picture

Status: Active » Needs review
StatusFileSize
new1011 bytes

Actually, try this one (small capitalization change).

dries’s picture

+++ modules/node/node.api.php	4 Jan 2010 16:29:21 -0000
@@ -999,11 +999,10 @@
+    $breadcrumb[] = l($node->field1, 'example/' . $node->field1 );

We can remove the space before ')'. Otherwise the patch looks good to me.

jhodgdon’s picture

StatusFileSize
new1010 bytes

Sorry about that. Habits left over from previous coding standards in different project...

dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks! Rock on, jhodgdon.

Status: Fixed » Closed (fixed)

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