You are here

public function QuizResultAnswerEntityTrait::getReportFormAnswerFeedback in Quiz 8.6

Same name and namespace in other branches
  1. 8.5 src/Entity/QuizResultAnswerEntityTrait.php \Drupal\quiz\Entity\QuizResultAnswerEntityTrait::getReportFormAnswerFeedback()
  2. 6.x src/Entity/QuizResultAnswerEntityTrait.php \Drupal\quiz\Entity\QuizResultAnswerEntityTrait::getReportFormAnswerFeedback()

Get the feedback form for the reportForm.

Return value

array|false An renderable FAPI array, or FALSE if no answer form.

1 call to QuizResultAnswerEntityTrait::getReportFormAnswerFeedback()
QuizResultAnswerEntityTrait::getReportForm in src/Entity/QuizResultAnswerEntityTrait.php
Creates the report form for the admin pages.

File

src/Entity/QuizResultAnswerEntityTrait.php, line 183

Class

QuizResultAnswerEntityTrait
Each question type must store its own response data and be able to calculate a score for that data.

Namespace

Drupal\quiz\Entity

Code

public function getReportFormAnswerFeedback() {
  $feedback = $this
    ->get('answer_feedback')
    ->getValue()[0];
  return array(
    '#title' => t('Enter feedback'),
    '#type' => 'text_format',
    '#default_value' => $feedback['value'] ?: '',
    '#format' => $feedback['format'] ?: filter_default_format(),
    '#attributes' => array(
      'class' => array(
        'quiz-report-score',
      ),
    ),
  );
}