fill-in-the-blank.php
1 month ago
image-answering.php
1 month ago
matching.php
1 month ago
multiple-choice.php
1 month ago
open-ended.php
1 month ago
ordering.php
1 month ago
true-false.php
1 month ago
true-false.php
54 lines
| 1 | <?php |
| 2 | /** |
| 3 | * True False |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @author Themeum <support@themeum.com> |
| 7 | * @link https://themeum.com |
| 8 | * @since 4.0.0 |
| 9 | */ |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | use TUTOR\Icon; |
| 14 | use Tutor\Components\SvgIcon; |
| 15 | |
| 16 | $field_name = $question_field_name_base ?? ''; |
| 17 | $register_rules = ''; |
| 18 | if ( $answer_is_required ) { |
| 19 | $register_rules = ", { required: '" . esc_js( $required_message ) . "' }"; |
| 20 | } |
| 21 | $register_attr = "register('{$field_name}'{$register_rules})"; |
| 22 | |
| 23 | ?> |
| 24 | |
| 25 | <div class="tutor-quiz-question-options"> |
| 26 | <?php foreach ( $question['question_answers'] as $answer ) : ?> |
| 27 | <label |
| 28 | class="tutor-quiz-question-option" |
| 29 | tabindex="0" |
| 30 | @keydown.space.prevent="$el.querySelector('input').click()" |
| 31 | @keydown.enter.prevent="$el.querySelector('input').click()" |
| 32 | > |
| 33 | <input |
| 34 | class="tutor-hidden" |
| 35 | type="radio" |
| 36 | tabindex="-1" |
| 37 | name="<?php echo esc_attr( $field_name ); ?>" |
| 38 | value="<?php echo esc_attr( $answer['answer_id'] ); ?>" |
| 39 | x-bind="<?php echo esc_attr( $register_attr ); ?>" |
| 40 | > |
| 41 | <?php SvgIcon::make()->name( $answer['is_correct'] ? Icon::CHECK_2 : Icon::CROSS )->size( 20 )->render(); ?> |
| 42 | <?php echo esc_html( $answer['answer_title'] ); ?> |
| 43 | </label> |
| 44 | <?php endforeach; ?> |
| 45 | </div> |
| 46 | |
| 47 | |
| 48 | <div |
| 49 | class="tutor-quiz-questions-error" |
| 50 | x-cloak |
| 51 | x-show="errors?.['<?php echo esc_attr( $field_name ); ?>']?.message" |
| 52 | x-text="errors?.['<?php echo esc_attr( $field_name ); ?>']?.message" |
| 53 | ></div> |
| 54 |