LLMS_Quiz_Attempt_Question::get_answer_array()

Get answer(s) as an array


Return Return

(array)


Top ↑

Source Source

File: includes/models/model.llms.quiz.attempt.question.php

	public function get_answer_array() {

		$ret      = array();
		$question = $this->get_question();
		$answers  = $this->get( 'answer' );

		if ( $answers ) {

			if ( $question->supports( 'choices' ) && $question->supports( 'grading', 'auto' ) ) {

				foreach ( $answers as $aid ) {

					$choice = $question->get_choice( $aid );
					$ret[]  = $choice ? $choice->get_choice() : _x( '[Deleted]', 'Selected quiz choice has been deleted.', 'lifterlms' );

				}
			} else {

				$ret = $answers;

			}
		}

		return apply_filters( 'llms_quiz_attempt_question_get_answer_array', $ret, $answers, $question, $this );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.27.0 Unknown.
3.16.15 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.