You are here

public function CourseObjectNode::getViewUrl in Course 3.x

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

Get the URL to view this course object, if any.

Return value

Url

Overrides CourseObject::getViewUrl

File

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

Class

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

Namespace

Drupal\course_content\Course\Object

Code

public function getViewUrl() {
  if ($this
    ->getNode()) {
    return Url::fromRoute('entity.node.canonical', [
      'node' => $this
        ->getNode()
        ->id(),
    ]);
  }
}