function commons_q_a_node_view in Drupal Commons 7.3
Implements hook_node_view().
Provides an answer button to bring a user down to the answer form.
File
- modules/
commons/ commons_q_a/ commons_q_a.module, line 26
Code
function commons_q_a_node_view($node, $view_mode) {
if ($node->type == 'question' && $view_mode == 'full') {
// Remove add comment link.
unset($node->content['links']['comment']);
// Add the answer link below.
if (commons_q_a_check_answer_access($node)) {
$node->content['links']['answer'] = array(
'#theme' => 'links__node__answer',
'#links' => array(
'answer-add' => array(
'title' => t('Answer'),
'attributes' => array(
'title' => t('Answer this question'),
),
'href' => 'node/' . $node->nid,
'fragment' => 'answer',
),
),
);
}
return $node;
}
}