You are here

public function CourseObjectBook::createInstance in Course 8.3

Same name and namespace in other branches
  1. 8.2 modules/course_book/src/Plugin/course/CourseObject/CourseObjectBook.php \Drupal\course_book\Plugin\course\CourseObject\CourseObjectBook::createInstance()
  2. 3.x modules/course_book/src/Plugin/course/CourseObject/CourseObjectBook.php \Drupal\course_book\Plugin\course\CourseObject\CourseObjectBook::createInstance()

Make the book.

Overrides CourseObjectNode::createInstance

File

modules/course_book/src/Plugin/course/CourseObject/CourseObjectBook.php, line 46

Class

CourseObjectBook
Plugin annotation @CourseObject( id = "book", label = "Book", handlers = { "fulfillment" = "\Drupal\course_book\Plugin\course\CourseObject\CourseObjectBookFulfillment" } )

Namespace

Drupal\course_book\Plugin\course\CourseObject

Code

public function createInstance($node = NULL) {
  $node = \Drupal\node\Entity\Node::create([
    'type' => $this
      ->getOption('node_type'),
  ]);
  $node->book['bid'] = 'new';
  parent::createInstance($node);
}