You are here

public function CourseObject::getOptions in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::getOptions()
  2. 8.2 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::getOptions()

Get options, with session options, except weight, having precedence.

Overrides CourseHandler::getOptions

10 calls to CourseObject::getOptions()
CourseObject::getOptionsSummary in src/Entity/CourseObject.php
Get core options summary.
CourseObject::getReadOnlyOptions in src/Entity/CourseObject.php
Get read-only options. These options have been processed by plugins and may have changed from their definitions.
CourseObject::optionsForm in src/Entity/CourseObject.php
Default options form for all course objects.
CourseObjectAttendance::optionsForm in modules/course_attendance/src/Plugin/course/CourseObject/CourseObjectAttendance.php
Default options form for all course objects.
CourseObjectBook::optionsForm in modules/course_book/src/Plugin/course/CourseObject/CourseObjectBook.php
Default options form for all course objects.

... See full list

File

src/Entity/CourseObject.php, line 455

Class

CourseObject
Parent abstract base class of all course objects.

Namespace

Drupal\course\Entity

Code

public function getOptions() {
  $options = parent::getOptions();
  $sessionDefaults = array();
  $cid = $this
    ->getCourse()
    ->id();
  $coid = $this
    ->id();
  if (!empty($_SESSION['course'][$cid]['editing'][$coid])) {
    $sessionDefaults += array_filter((array) $_SESSION['course'][$cid]['editing'][$coid], array(
      $this,
      'optionFilter',
    ));
    unset($sessionDefaults['weight']);
  }
  return array_merge($options, (array) $sessionDefaults);
}