Fix for links gefummel

  1. /**
  2.  * Override node template variables.
  3.  */
  4. function mymodule_preprocess_node(&$vars) {
  5.   $node_links = isset($vars['node']->links) ? $vars['node']->links : array();
  6.   foreach ($node_links as $key => $link) {
  7.     if (isset($link['href'])) {
  8.       // Pass in $link as $options, they share the same keys.
  9.       $vars["link_$key"] = l($link['title'], $link['href'], $link);
  10.     }
  11.     else if (!empty($link['title'])) {
  12.       // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
  13.       if (empty($link['html'])) {
  14.         $link['title'] = check_plain($link['title']);
  15.       }
  16.       $span_attributes = '';
  17.       if (isset($link['attributes'])) {
  18.         $span_attributes = drupal_attributes($link['attributes']);
  19.       }
  20.       $vars["link_$key"] = '<span'. $span_attributes .'>'. $link['title'] .'</span>';
  21.     }
  22.     if ($vars['page'] == FALSE) {
  23.       unset($vars['node']->links[$key]);
  24.     }
  25.   }
  26.   if ($vars['page'] == TRUE) {
  27.     $submitted = array();
  28.     $submitted[] = $vars['date'];
  29.     $submitted[] = $vars['name'];
  30.     if (isset($vars['comment_count'])) {
  31.       $submitted[] = l(format_plural($vars['comment_count'], '1 comment', '@count comments'),
  32.         'node/'. $vars['node']->nid,
  33.         array(
  34.           'attributes' => array('title' => t('Jump to the first comment of this posting.')),
  35.           'fragment' => 'comments'
  36.         )
  37.       );
  38.     }
  39.     $vars['submitted_inline'] = theme('item_list', $submitted);
  40.   }
  41.   $vars['links'] = !empty($vars['node']->links) ? theme('links', $vars['node']->links, array('class' => 'links inline')) : '';
  42. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.