You are here

function course_certificate_course_outline_completion_links_alter in Course 3.x

Same name and namespace in other branches
  1. 8.3 modules/course_certificate/course_certificate.module \course_certificate_course_outline_completion_links_alter()
  2. 8.2 modules/course_certificate/course_certificate.module \course_certificate_course_outline_completion_links_alter()
  3. 6 modules/course_certificate/course_certificate.module \course_certificate_course_outline_completion_links_alter()
  4. 7.2 modules/course_certificate/course_certificate.module \course_certificate_course_outline_completion_links_alter()
  5. 7 modules/course_certificate/course_certificate.module \course_certificate_course_outline_completion_links_alter()

Implements hook_course_outline_completion_links_alter().

Add a download certificate link.

File

modules/course_certificate/course_certificate.module, line 14

Code

function course_certificate_course_outline_completion_links_alter(&$links, Course $course, AccountInterface $account) {
  if ($course
    ->access('certificate', $account)) {
    $links['certificate'] = Link::createFromRoute(t('Download certificate'), 'certificate.course', [
      'course' => $course
        ->id(),
    ], [
      'title' => t('Download a PDF of your certificate.'),
    ]);
  }
}