You are here

function CourseObject::getTitle in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::getTitle()
  2. 8.2 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::getTitle()
6 calls to CourseObject::getTitle()
CourseObject::optionsForm in src/Entity/CourseObject.php
Default options form for all course objects.
CourseObject::save in src/Entity/CourseObject.php
Apply configuration from session and let objects create their instances before saving the course object.
CourseObjectNode::getTitle in modules/course_content/src/Course/Object/CourseObjectNode.php
Get the object title, or return this object's node's title if the option is set.
CourseObjectQuiz::createInstance in modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuiz.php
Create the quiz node and set it as this object's instance.
CourseObjectQuiz::getCloneAbility in modules/course_quiz/src/Plugin/course/CourseObject/CourseObjectQuiz.php
Returns an translated error message if this object has issues with cloning.

... See full list

1 method overrides CourseObject::getTitle()
CourseObjectNode::getTitle in modules/course_content/src/Course/Object/CourseObjectNode.php
Get the object title, or return this object's node's title if the option is set.

File

src/Entity/CourseObject.php, line 801

Class

CourseObject
Parent abstract base class of all course objects.

Namespace

Drupal\course\Entity

Code

function getTitle() {
  $object_info = course_get_handlers('object');

  // If title is not specified, set title from component.
  if (!$this
    ->getOption('title')) {

    // Get the component name from object info.
    $title = $object_info[$this
      ->getOption('object_type')]['label'];
    $this
      ->setOption('title', $title);
  }
  return $this
    ->getOption('title');
}