dozent_get_quiz_option( int $quiz_id, null $option_key = null, false $default = false )
Get the quiz option by quiz ID
Description
Pass option_key as second param to get specific Option value, else it will return all options as array.
Example usage:
$show_time dozent_get_quiz_option( $quiz_id, 'show_time' );
See also
Parameters
- $quiz_id
-
(int) (Required)
- $option_key
-
(null) (Optional)
Default value: null
- $default
-
(false) (Optional)
Default value: false
Return
(mixed|void)
Source
File: includes/quiz-functions.php
function dozent_get_quiz_option( $quiz_id = 0, $option_key = null, $default = false ) { $quiz_id = dozent_get_post_id( $quiz_id ); $options = (array) maybe_unserialize( get_post_meta( $quiz_id, '_quiz_option', true ) ); if ( $option_key ) { /** * Filter quiz single option when $option_key is exists * * @since DozentLMS 1.0.0 * * @param mixed $option_value Option Value returns by dozent_get_quiz_option(); * @param int $quiz_id Quiz ID passed on the function dozent_get_quiz_option(); * @param string $option_key Option Key * @param mixed $default Default value of the function dozent_get_quiz_option(); */ return apply_filters( 'dozent_get_quiz_option', dozent_array_get( $option_key, $options, $default ), $quiz_id, $option_key, $default ); } /** * Filter quiz options * * This will fiere when dozent_get_quiz_option() has been called bat not passed any $option_key * in the second param * * @since DozentLMS 1.0.0 * * @param array $options Option Value as array by dozent_get_quiz_option(); * @param int $quiz_id Quiz ID passed on the function dozent_get_quiz_option(); */ return apply_filters( 'dozent_get_quiz_options', $options, $quiz_id ); }
Changelog
Version | Description |
---|---|
DozentLMS 1.0.0 | Introduced. |