You are here

public function CourseObjectBook::createInstance in Course 3.x

Same name and namespace in other branches
  1. 8.3 modules/course_book/src/Plugin/course/CourseObject/CourseObjectBook.php \Drupal\course_book\Plugin\course\CourseObject\CourseObjectBook::createInstance()
  2. 8.2 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 49

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 = Node::create([
    'type' => $this
      ->getOption('node_type'),
  ]);
  $node->book['bid'] = 'new';
  parent::createInstance($node);
}