function course_poll_fulfill in Course 3.x
Same name and namespace in other branches
- 8.3 modules/course_poll/course_poll.module \course_poll_fulfill()
- 8.2 modules/course_poll/course_poll.module \course_poll_fulfill()
- 6 modules/course_poll/course_poll.module \course_poll_fulfill()
- 7.2 modules/course_poll/course_poll.module \course_poll_fulfill()
- 7 modules/course_poll/course_poll.module \course_poll_fulfill()
Fulfill the voting object.
1 string reference to 'course_poll_fulfill'
- course_poll_form_poll_view_form_alter in modules/
course_poll/ course_poll.module - Implements hook_form_FORMID_alter().
File
- modules/
course_poll/ course_poll.module, line 34
Code
function course_poll_fulfill($form, FormStateInterface $form_state) {
$account = \Drupal::currentUser();
// Find the course object associated with this poll.
if ($courseObject = course_get_course_object('poll', $form['#entity']
->id())) {
$courseObject
->getFulfillment($account)
->setOption('instance', $form_state
->getValue('choice'))
->setComplete()
->save();
}
}