You are here

public function CourseObject::createInstance in Course 3.x

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

Creates a course object.

For example, this would create the new node and return the node ID if this was a CourseObjectNode.

Do not confuse this with save(), which saves the course outline record for tracking.

Course objects should call setInstanceId() if this is a course object that creates external resources.

1 call to CourseObject::createInstance()
CourseObject::save in src/Entity/CourseObject.php
Apply configuration from session and let objects create their instances before saving the course object.
6 methods override CourseObject::createInstance()
CourseObjectCommerce::createInstance in modules/course_commerce/src/Plugin/course/CourseObject/CourseObjectCommerce.php
Don't create new products.
CourseObjectNode::createInstance in modules/course_content/src/Course/Object/CourseObjectNode.php
Create a node and set it as this course object's node.
CourseObjectPoll::createInstance in modules/course_poll/src/Plugin/course/CourseObject/CourseObjectPoll.php
Creates a course object.
CourseObjectQuiz::createInstance in modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuiz.php
Create the quiz node and set it as this object's instance.
CourseObjectUbercart::createInstance in modules/course_uc/src/Plugin/course/CourseObject/CourseObjectUbercart.php
Don't create new products.

... See full list

File

src/Entity/CourseObject.php, line 789

Class

CourseObject
Parent abstract base class of all course objects.

Namespace

Drupal\course\Entity

Code

public function createInstance() {

  //$this->setInstanceId($id);
}