I've tried all sorts of things but I can't for the life of me figure out how to theme primary links in Dupal 6.x.
theme_menu_item_link() doesn't seem to be called for primary links so I can't use that. Instead menu_primary_links() is called but this is not themeable. I want to theme primary links so that I can get rid of the title attribute from the menu items.

Can anyone tell me how to theme primary links in D6, or failing that, how to display the links without the title attribute?

Thanks

Comments

Ibn al-Hazardous’s picture

Documentation here: http://api.drupal.org/api/function/theme_links/6

Was looking for the same thing when I found your post... :)

Update:
Scratch that - I didn't get it to work myself... :(

grobemo’s picture

theme_links is the function you want, I think.

Here's the code I use to theme my primary links at the moment. I'm changing 'Log in' to 'Welcome, @user' for authenticated users and hiding the Log in link from unauthenticated users. (The site's not quite ready for prime time, so I'm not ready to make the log in so obvious.) If anyone has improvements, please share!

function phptemplate_links($links,$attributes = array('class' => 'links')) {
  
  global $user;
  
  // Replace 'Log in' with 'Welcome, username'; delete log in for unathenticated users.
  foreach ($links as $key => &$link) {
	if ($link['href']=='user') {
	  if (user_is_logged_in()) {
		$link['title'] = 'Welcome, '. $user->name;
	  }
	  else {
		unset($links[$key]);
	  }
	}
  }  
  
  // Process primary links normally.
  return theme_links($links,$attributes);
}

So maybe you want to set $links['title'] = $links['href'] or unset($links[$key]['title'])?

Anyone know how to get this to operate only on primary links (in case someone wants to leave secondary links alone, for instance)?