LLMS_Quiz_Attempt::get_question( int $question_id, string $return = 'id' )
Retrieve the question in the attempt.
Parameters Parameters
- $question_id
-
(int) (Required) WP Post ID of the required LLMS_Question.
- $return
-
(string) (Optional) Return type 'id|array'. Default 'id'.
Default value: 'id'
Return Return
(int|array|false)
Source Source
File: includes/models/model.llms.quiz.attempt.php
public function get_question( $question_id, $return = 'id' ) {
$ids = array_map( 'intval', array_column( $this->get_questions(), 'id' ) );
$index = array_search( (int) $question_id, $ids, true );
return $index >= 0 ?
'id' === $return ? $question_id : $this->get_questions()[ $index ]
:
false;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.8.0 | Introduced. |