CourseObjectContent.php in Course 8.2
File
modules/course_content/src/Plugin/course/CourseObject/CourseObjectContent.php
View source
<?php
namespace Drupal\course_content\Plugin\course\CourseObject;
use Drupal\course_content\Course\Object\CourseObjectNode;
use Drupal\node\Entity\NodeType;
class CourseObjectContent extends CourseObjectNode {
function getNodeTypes() {
$content_types = [];
$types = NodeType::loadMultiple();
foreach ($types as $name => $type) {
if ($type
->getThirdPartySetting('course_content', 'use')) {
$content_types[] = $name;
}
}
return $content_types;
}
function optionsDefinition() {
$options = parent::optionsDefinition();
$options['node_type'] = $this
->getNodeTypes()[0];
return $options;
}
}
Classes
Name |
Description |
CourseObjectContent |
Plugin annotation
@CourseObject(
id = "content",
label = "Course content",
handlers = {
"fulfillment" = "\Drupal\course_content\Course\Object\CourseObjectNodeFulfillment"
}
) |