public function CourseObjectQuiz::optionsForm in Course 8.2
Same name and namespace in other branches
- 8.3 modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuiz.php \Drupal\course_quiz\Plugin\course\CourseObject\CourseObjectQuiz::optionsForm()
- 3.x modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuiz.php \Drupal\course_quiz\Plugin\course\CourseObject\CourseObjectQuiz::optionsForm()
Add an option only pertinent to quiz?
Overrides CourseObject::optionsForm
File
- modules/
course_quiz/ src/ Plugin/ course/ CourseObject/ CourseObjectQuiz.php, line 81
Class
- CourseObjectQuiz
- Plugin annotation @CourseObject( id = "quiz", label = "Quiz", handlers = { "fulfillment" = "\Drupal\course_quiz\Plugin\course\CourseObject\CourseObjectQuizFulfillment" } )
Namespace
Drupal\course_quiz\Plugin\course\CourseObjectCode
public function optionsForm(&$form, &$form_state) {
parent::optionsForm($form, $form_state);
$defaults = $this
->getOptions();
$form['instance'] = array(
'#type' => 'entity_autocomplete',
'#target_type' => 'quiz',
'#default_value' => $this
->getOption('instance') ? Quiz::load($this
->getOption('instance')) : NULL,
);
$form['quiz_goto'] = array(
'#type' => 'select',
'#title' => t('Quiz entry point'),
'#options' => array(
'view' => t('View Quiz'),
'take' => t('Take Quiz'),
),
'#default_value' => $defaults['quiz_goto'],
'#description' => t('Selecting "Take Quiz" will launch the user directly into taking the quiz, without viewing the quiz body.'),
);
$form['grading']['passing_grade'] = array(
'#title' => t('Passing grade'),
'#type' => 'textfield',
'#size' => 4,
'#default_value' => $defaults['passing_grade'],
'#description' => t('The user will not be able to proceed past this object unless this grade is met.'),
);
}