You are here

function answers_best_answer_preprocess_node in Answers 7.4

Implements hook_preprocess_node().

File

answers_best_answer/answers_best_answer.module, line 368
Support selection of 'Best Answers' for the 'Answers' module.

Code

function answers_best_answer_preprocess_node(&$vars) {
  if ($vars['node']->type == 'answers_answer') {
    $flag = flag_get_flag('best_answer') or die('no "best_answer" flag defined');
    if ($flag
      ->is_flagged($vars['node']->nid)) {

      // Add css class to mark a best answer.
      $vars['classes_array'][] = 'answers-best-answer';
      $vars['is_best_answer'] = TRUE;
    }
  }
}