You are here

public function CourseObjectAccessGrade::getObjectOptions in Course 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/course/CourseObjectAccess/CourseObjectAccessGrade.php \Drupal\course\Plugin\course\CourseObjectAccess\CourseObjectAccessGrade::getObjectOptions()
  2. 3.x src/Plugin/course/CourseObjectAccess/CourseObjectAccessGrade.php \Drupal\course\Plugin\course\CourseObjectAccess\CourseObjectAccessGrade::getObjectOptions()

Helper method to get possible graded objects.

Overrides CourseObjectAccessPluginBase::getObjectOptions

1 call to CourseObjectAccessGrade::getObjectOptions()
CourseObjectAccessGrade::optionsForm in src/Plugin/course/CourseObjectAccess/CourseObjectAccessGrade.php

File

src/Plugin/course/CourseObjectAccess/CourseObjectAccessGrade.php, line 140

Class

CourseObjectAccessGrade
Plugin annotation @CourseObjectAccess( id = "grade", label = @Translation("Grade"), )

Namespace

Drupal\course\Plugin\course\CourseObjectAccess

Code

public function getObjectOptions() {
  $options = array(
    '',
  );
  foreach ($this
    ->getCourseObject()
    ->getCourse()
    ->getObjects() as $courseObject) {
    if ($courseObject
      ->getId() != $this
      ->getCourseObject()
      ->getId() && $courseObject
      ->isGraded()) {
      $options[$courseObject
        ->getId()] = $courseObject
        ->getTitle();
    }
  }
  return $options;
}