public function CourseObject::setCourse in Course 3.x
Same name and namespace in other branches
- 8.3 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::setCourse()
- 8.2 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::setCourse()
Set the Course for this CourseObject.
Parameters
Course|int $course: A Course or node ID.
Return value
File
- src/
Entity/ CourseObject.php, line 717
Class
- CourseObject
- Parent abstract base class of all course objects.
Namespace
Drupal\course\EntityCode
public function setCourse($course) {
if (is_numeric($course)) {
$this
->setOption('cid', $course);
}
else {
$this
->setOption('cid', $course
->id());
}
return $this;
}