function talk_link in Talk 6
Same name and namespace in other branches
- 5 talk.module \talk_link()
Implementation of hook_link().
2 string references to 'talk_link'
- TalkTests::setUp in ./
talk.test - Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
- talk_update_1 in ./
talk.install - Provide 3 different settings instead of the one. Default to the one.
File
- ./
talk.module, line 144 - Comments are displayed in a separate 'talk' tab, for node types you wish
Code
function talk_link($type, $node = NULL, $teaser = FALSE) {
$addcmnt = _talk_node_comment_value($node) == COMMENT_NODE_READ_WRITE && (!$teaser || variable_get('talk_addcmnt_teaser', TRUE));
if ($type == 'node' && talk_activated($node->type) && user_access('access comments') && _talk_node_comment_value($node) && (arg(0) != 'comment' || arg(1) != 'reply')) {
$result = array();
// If there are comments, display "Talk page (X comments)" link to talk page.
if ($node->comment_count) {
$title = talk_title($node, 'link');
if (!empty($title)) {
$result['talk_comments'] = array(
'title' => $title,
'href' => 'node/' . $node->nid . '/talk',
'attributes' => array(
'title' => t('Jump to the first comment of this posting.'),
),
);
}
}
elseif ($addcmnt) {
if (user_access('post comments')) {
$result['talk_add'] = array(
'title' => t('Add new comment'),
'fragment' => 'comment-form',
);
if (variable_get('comment_form_location_' . $node->type, COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
$result['talk_add']['href'] = 'comment/reply/' . $node->nid;
}
else {
$result['talk_add']['href'] = 'node/' . $node->nid . '/talk';
}
}
else {
$result['talk_forbidden']['title'] = theme('comment_post_forbidden', $node);
$result['talk_forbidden']['html'] = TRUE;
}
}
return $result;
}
}