The function project_link() doesn't work properly. So, here is a correct piece of code:

function project_link($type, $node = 0, $main = 0) {
  $links = array();

  if ($type == 'node' && $node->type == 'project_project' && user_access('access
    $links['project_view_all'] = array(
      'title' => t('Projects'),
      'href' => 'project',
      'attributes' => array('title' => t('View all projects.')),
    );
  }

  return $links;
}
CommentFileSizeAuthor
#2 link_to_projects.patch658 bytesUstas

Comments

aclight’s picture

Status: Needs review » Active

Hi Ustas

A) This isn't an actual patch, so it shouldn't be set to CNR
B) I think this line is cut off in your original posting:

if ($type == 'node' && $node->type == 'project_project' && user_access('access

I haven't looked yet to see if I can replicate the problem, but you don't go into much detail about why the function doesn't work properly. What behavior are you seeing and what do you expect?

Also, are you really using the beta version, or are you using the dev version? The two are quite different.

Ustas’s picture

StatusFileSize
new658 bytes

Sorry, I was in hurry.

I use 5.x-0.1-beta, but in CVS version this function is the same. I noticed that there's no link to the main page of the project module in the list representation of nodes. Besides there is only one case branch with the $type == 'page' in project_link() function. So, I looked through the code of blog.module and find out that the $type equals 'node' when this function called during preparation of the list of nodes. My patch makes this fix with a minor refactoring.

dww’s picture

function project_link() looks stupid and wrong, to me, with or without this patch.

A) The link to the main project listing is included in the breadcrumbs.

B) Why would you want to see a link to the main project browsing pages on every project node like this? These links are for things like adding comments or viewing printer-friendly versions and other things specific to that particular node, not site navigation.

I'm inclined to just completely remove this hook instead of fixing this bug.

hunmonk’s picture

agreed. let's get that out of there. bad use of that functionality.

dww’s picture

Title: project_link() link bug fix needed » Remove inappropriate project_link()
Assigned: Unassigned » dww
Status: Active » Fixed

Code ripped out of HEAD, DRUPAL-4-7--2 and DRUPAL-4-7.

Anonymous’s picture

Status: Fixed » Closed (fixed)