You are here

function answers_view in Answers 5.2

File

./answers.module, line 433
Enables the creation of question nodes that can be answered by posting answer nodes.

Code

function answers_view($node, $teaser = FALSE, $page = FALSE) {
  $path = drupal_get_path('module', 'answers');
  $node = node_prepare($node, $teaser);
  $node->answerlist = answers_get_answers($node, $teaser, $page);
  $answercount = count($node->answerlist);
  $answerbuttons = module_invoke_all('answers', 'answerbuttons', $node->nid, $answercount);
  $node->answer_buttons = theme('answer_buttons', $answerbuttons, $answercount);
  $node->content['answers'] = array(
    '#value' => theme('answers_content', $node, $teaser),
    '#weight' => 1,
  );
  $node->content['ansposter'] = array(
    '#value' => '<div id="ansposter" style="padding: 0px; margin: 0px;"></div>',
    '#weight' => 2,
  );
  if ($page) {

    // Breadcrumb navigation
    $breadcrumb[] = array(
      'path' => 'quest/list',
      'title' => t('Answers'),
    );
    $breadcrumb[] = array(
      'path' => 'node/' . $node->nid,
    );
    menu_set_location($breadcrumb);

    // TODO: change for 6.x
  }
  return $node;
}