You are here

public function CourseObjectAccessGrade::getObjectOptions in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Plugin/course/CourseObjectAccess/CourseObjectAccessGrade.php \Drupal\course\Plugin\course\CourseObjectAccess\CourseObjectAccessGrade::getObjectOptions()
  2. 8.2 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::buildConfigurationForm in src/Plugin/course/CourseObjectAccess/CourseObjectAccessGrade.php
Define the form to be used in the object access settings area.

File

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

Class

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

Namespace

Drupal\course\Plugin\course\CourseObjectAccess

Code

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