You are here

public function CourseObjectAttendance::take in Course 3.x

Course object entry point for taking. This method should return a value corresponding to the type set in getTakeType().

Overrides CourseObject::take

File

modules/course_attendance/src/Plugin/course/CourseObject/CourseObjectAttendance.php, line 31

Class

CourseObjectAttendance
Plugin annotation @CourseObject( id = "attendance", label = "Attendance", )

Namespace

Drupal\course_attendance\Plugin\course\CourseObject

Code

public function take() {
  $account = Drupal::currentUser();
  if ($this
    ->getFulfillment($account)
    ->isComplete()) {
    return [
      '#markup' => t("You have been marked attended by an administrator."),
    ];
  }
  else {
    return [
      '#markup' => t("You must be marked attended by an administrator."),
    ];
  }
}