mysite_link($type, $node = NULL, $teaser = FALSE)
mysite.module, line 500
Implementation of hook_link()
function mysite_link($type, $node = NULL, $teaser = FALSE) {
if ($type == 'node' && $node->nid) {
$show = variable_get('mysite_links', 1);
// 0 == no; 1 == always, 2 == page view only
if ($show == 1 || ($show == 2 && !$teaser)) {
global $user;
if ($user->uid > 0 && user_access('edit mysite')) {
$link = l(mysite_sitename(), 'mysite/'. $user->uid .'/view', array('class' => 'mysite-anchor'));
drupal_add_js(drupal_get_path('module', 'mysite') .'/mysite_links.js', 'module');
drupal_add_css(drupal_get_path('module', 'mysite') .'/mysite_links.css');
$links = array();
// we already prepare the links in hook_block, so get them and theme them.
$data = mysite_block('view', 0, $node->nid);
$string = str_replace('<ul>', '', $data['content']);
$content = str_replace('</ul>', '', $string);
$links['mysite'] = array(
'title' => theme('mysite_links', $link, $content),
'html' => TRUE
);
return $links;
}
}
}
}