You are here

public function CourseObjectNode::getViewUrl 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::getViewUrl()
  2. 3.x 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 107

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(),
    ]);
  }
}