You are here

function quiz_get_feedback_options in Quiz 8.5

Same name and namespace in other branches
  1. 8.6 quiz.module \quiz_get_feedback_options()
  2. 7.6 quiz.module \quiz_get_feedback_options()
  3. 7.5 quiz.module \quiz_get_feedback_options()
  4. 6.x quiz.module \quiz_get_feedback_options()

Get the feedback options for Quizzes.

5 calls to quiz_get_feedback_options()
QuizAdminForm::buildForm in src/Form/QuizAdminForm.php
This builds the main settings form for the quiz module.
QuizEntityForm::buildForm in src/Entity/QuizEntityForm.php
Form constructor.
QuizResult::hasReview in src/Entity/QuizResult.php
Can the quiz taker view any reviews right now?
QuizTestBase::createQuiz in tests/src/Functional/QuizTestBase.php
Create a quiz with all end feedback settings enabled by default.
quiz_entity_extra_field_info in ./quiz.module
Implements hook_field_extra_fields().

File

./quiz.module, line 743
Contains quiz.module

Code

function quiz_get_feedback_options() {
  $feedback_options = Drupal::moduleHandler()
    ->invokeAll('quiz_feedback_options');
  $view_modes = Drupal::service('entity_display.repository')
    ->getViewModes('quiz_question');
  $feedback_options["quiz_question_view_full"] = t('Question') . ': ' . 'Full';
  foreach ($view_modes as $view_mode => $info) {
    $feedback_options["quiz_question_view_" . $view_mode] = t('Question') . ': ' . $info['label'];
  }
  $feedback_options += array(
    'attempt' => t('Attempt'),
    'choice' => t('Choices'),
    'correct' => t('Whether correct'),
    'score' => t('Score'),
    'answer_feedback' => t('Answer feedback'),
    'question_feedback' => t('Question feedback'),
    'solution' => t('Correct answer'),
    'quiz_feedback' => t('@quiz feedback', array(
      '@quiz' => _quiz_get_quiz_name(),
    )),
  );
  Drupal::moduleHandler()
    ->alter('quiz_feedback_options', $feedback_options);
  return $feedback_options;
}