You are here

public function QuizResult::label in Quiz 8.5

Same name and namespace in other branches
  1. 8.6 src/Entity/QuizResult.php \Drupal\quiz\Entity\QuizResult::label()
  2. 6.x src/Entity/QuizResult.php \Drupal\quiz\Entity\QuizResult::label()

Get the label for this quiz result.

Return value

string

Overrides ContentEntityBase::label

File

src/Entity/QuizResult.php, line 123

Class

QuizResult
Defines the Quiz entity class.

Namespace

Drupal\quiz\Entity

Code

public function label() {
  $quiz = $this
    ->getQuiz();
  $user = $this
    ->get('uid')
    ->referencedEntities()[0];
  return t('@user\'s @quiz result in "@title"', array(
    '@user' => $user
      ->getDisplayName(),
    '@quiz' => _quiz_get_quiz_name(),
    '@title' => $quiz
      ->get('title')
      ->getString(),
  ));
}