DrupalBin
Submit Code
About
Recent Posts
Code
14 min 6 sec
ago
Code
29 min 43 sec
ago
css path
2 hours 14 min
ago
Fix for Code
6 hours 13 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for overriding favorite nodes links
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
function phptemplate_links($links, $attributes = array('class' => 'links')) { $output = ''; if (count($links) > 0) { $output = '<ul'. drupal_attributes($attributes) .'>'; $num_links = count($links); $i = 1; foreach ($links as $key => $link) { $class = ''; // Automatically add a class to each link and also to each LI if (isset($link['attributes']) && isset($link['attributes']['class'])) { $link['attributes']['class'] .= ' ' . $key; $class = $key; } else { $link['attributes']['class'] = $key; $class = $key; } // Add first and last classes to the list of links to help out themers. $extra_class = ''; if ($i == 1) { $extra_class .= 'first '; } if ($i == $num_links) { $extra_class .= 'last '; } $output .= '<li class="'. $extra_class . $class .'">'; // Is the title HTML? $html = isset($link['html']) && $link['html']; // Initialize fragment and query variables. $link['query'] = isset($link['query']) ? $link['query'] : NULL; $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL; if (isset($link['href'])) { $output .= '<div>'. l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html) .'</div>; } else if ($link['title']) { //Some links are actually not links, but we wrap these in <span> for adding title and class attributes if (!$html) { $link['title'] = check_plain($link['title']); } $output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>'; } $i++; $output .= "</li>\n"; } $output .= '</ul>'; } return $output; }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.