You are here

function CourseObjectContent::getNodeTypes in Course 8.3

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

Return a list of valid node types.

Return value

array An array with node type machine names.

Overrides CourseObjectNode::getNodeTypes

File

modules/course_content/src/Plugin/course/CourseObject/CourseObjectContent.php, line 19

Class

CourseObjectContent
Plugin annotation @CourseObject( id = "content", label = "Course content", handlers = { "fulfillment" = "\Drupal\course_content\Course\Object\CourseObjectNodeFulfillment" } )

Namespace

Drupal\course_content\Plugin\course\CourseObject

Code

function getNodeTypes() {
  $content_types = [];
  $types = NodeType::loadMultiple();
  foreach ($types as $name => $type) {
    if ($type
      ->getThirdPartySetting('course_content', 'use')) {
      $content_types[] = $name;
    }
  }
  return $content_types;
}