You are here

public function CourseObjectNode::optionsDefinition in Course 8.2

Same name and namespace in other branches
  1. 8.3 modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::optionsDefinition()
  2. 3.x modules/course_content/src/Course/Object/CourseObjectNode.php \Drupal\course_content\Course\Object\CourseObjectNode::optionsDefinition()

Define configuration elements and their defaults.

Extended classes should call parent::optionsDefinition first to get the parent's configuration.

Overrides CourseObject::optionsDefinition

2 calls to CourseObjectNode::optionsDefinition()
CourseObjectBook::optionsDefinition in modules/course_book/src/Plugin/course/CourseObject/CourseObjectBook.php
Define configuration elements and their defaults.
CourseObjectContent::optionsDefinition in modules/course_content/src/Plugin/course/CourseObject/CourseObjectContent.php
If course object is saved without configuration, make sure we have a default node type.
2 methods override CourseObjectNode::optionsDefinition()
CourseObjectBook::optionsDefinition in modules/course_book/src/Plugin/course/CourseObject/CourseObjectBook.php
Define configuration elements and their defaults.
CourseObjectContent::optionsDefinition in modules/course_content/src/Plugin/course/CourseObject/CourseObjectContent.php
If course object is saved without configuration, make sure we have a default node type.

File

modules/course_content/src/Course/Object/CourseObjectNode.php, line 143

Class

CourseObjectNode
A course object that uses a node as a base.

Namespace

Drupal\course_content\Course\Object

Code

public function optionsDefinition() {
  $defaults = parent::optionsDefinition();

  // @todo this also needs to check if the content exists or not
  $defaults['private'] = $this
    ->hasNodePrivacySupport();
  $options = array_intersect_key(node_type_get_names(), array_combine($this
    ->getNodeTypes(), $this
    ->getNodeTypes()));
  $defaults['node_type'] = key($options);
  $defaults['use_node_title'] = 0;
  $defaults['clone_and_reference'] = 0;
  $defaults['use_existing_node'] = 0;
  return $defaults;
}