Posted by bangpound on August 9, 2007 at 7:43pm
Jump to:
| Project: | Custom Links |
| Version: | 5.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I've created some links that I want to display only in the sidebar block, but they also display in the full node view and teasers. I don't think this is the intended behavior. Am I wrong?
Comments
#1
i changed the first condition in the foreach loop in _custom_links_build_links function.
function _custom_links_build_links($node, $teaser = FALSE, $block = FALSE) {
$links = array();
$custom_links = _custom_links_load_all_links();
foreach ($custom_links as $link) {
if (($block && $link->display != 3) || (!$block && $link->display == 3)) {
continue;
}
if (($link->display == 0 && $teaser) || ($link->display == 1 && !$teaser)) {
continue;
}
if ($link->node_type && $node->type != $link->node_type) {
continue;
}
if ($link->viewer_perm && !user_access($link->viewer_perm)) {
continue;
}
if ($link->author_perm) {
$author = user_load(array('uid' => $node->uid));
if (!user_access($link->author_perm, $author)) {
continue;
}
}
$links[$link->link_key]['title'] = $link->title;
if (!empty($link->path)) {
$links[$link->link_key]['href'] = $link->path;
}
if (!empty($link->query)) {
$links[$link->link_key]['query'] = $link->query;
}
if (!empty($link->fragment)) {
$links[$link->link_key]['fragment'] = $link->fragment;
}
if (module_exists('token')) {
$links[$link->link_key] = token_replace($links[$link->link_key], 'node', $node);
}
$links[$link->link_key]['html'] = $link->check_html;
}
return $links;
}