You are here

public function QuizFeedbackType::getComponent in Quiz 6.x

Same name and namespace in other branches
  1. 8.6 src/Entity/QuizFeedbackType.php \Drupal\quiz\Entity\QuizFeedbackType::getComponent()
  2. 8.5 src/Entity/QuizFeedbackType.php \Drupal\quiz\Entity\QuizFeedbackType::getComponent()

File

src/Entity/QuizFeedbackType.php, line 57

Class

QuizFeedbackType
Defines the quiz type entity class.

Namespace

Drupal\quiz\Entity

Code

public function getComponent() {
  if (empty($this->component)) {

    // Provide a default for now.
    // @todo make expression configurable.
    $this->component = [
      'expression' => [
        'id' => 'rules_and',
      ],
      'context_definitions' => [
        'quiz_result' => [
          'type' => 'entity:quiz_result',
          'label' => 'Quiz result',
          'description' => 'Quiz result to evaluate feedback',
        ],
      ],
    ];
  }
  if (!isset($this->componentObject)) {
    $this->componentObject = RulesComponent::createFromConfiguration($this->component);
  }
  return $this->componentObject;
}