DrupalBin
Submit Code
About
Recent Posts
Code
5 min 3 sec
ago
Code
31 min 58 sec
ago
Fix for Code
1 hour 45 min
ago
Code
1 hour 46 min
ago
more
Tags
CCK
fapi
javascript
jquery
menu
module
Panels
simpletest
template.php
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
overriding favorite nodes links
View
Download
Fix
June 13, 2008 - 9:48am — Anonymous
/**
* Implementation of hook_links().
*/
function
favorite_nodes_link
(
$type
,
$node
=
null
,
$teaser
=
false
)
{
global
$user
;
$links
=
array
(
)
;
if
(
$type
==
'node'
&& !
$teaser
)
{
if
(
variable_get
(
FAVORITE_NODES_NODE_TYPE .
$node
->
type
,
0
)
)
{
if
(
user_access
(
FAVORITE_NODES_PERM_ADD
)
)
{
if
(
!_favorite_nodes_check
(
$node
->
nid
)
)
{
$links
[
]
=
array
(
'title'
=>
t
(
'add to favorites'
)
,
'href'
=>
'favorite_nodes/add/'
.
$node
->
nid
,
'class'
=>
'fav'
)
;
}
else
{
if
(
user_access
(
FAVORITE_NODES_PERM_VIEW
)
)
{
$links
[
]
=
array
(
'title'
=>
t
(
'in favorites'
)
)
;
$links
[
]
=
array
(
'title'
=>
t
(
'remove from favorites'
)
,
'href'
=>
'favorite_nodes/delete/'
.
$node
->
nid
)
;
}
}
}
}
}
return
$links
;
}
module
theme