You are here

function answers_question_answers in Answers 7.4

Return all answers to a question.

Parameters

object $question: A fully loaded question node.

3 calls to answers_question_answers()
answers_best_answer_flag in answers_best_answer/answers_best_answer.module
Implements hook_flag().
answers_best_answer_flag_flag in answers_best_answer/answers_best_answer.module
Implements hook_flag_flag().
answers_best_answer_question_best_answer in answers_best_answer/answers_best_answer.module
Returns the best answer for a question if one is set. Returns NULL otherwise.

File

./answers.module, line 448
The Answers module.

Code

function answers_question_answers($question) {
  $query = new EntityFieldQuery();
  $entities = $query
    ->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'answers_answer')
    ->fieldCondition('answers_related_question', 'target_id', $question->nid, '=')
    ->execute();
  return empty($entities) ? array() : entity_load('node', array_keys($entities['node']));
}