Skip to content

Commit

Permalink
Whole course card now clickable if only one link in the card.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed Apr 20, 2024
1 parent a2b9985 commit a1b5f74
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions classes/output/core/course_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,17 @@ protected function coursecat_coursebox_content(coursecat_helper $chelper, $cours
$courseurl = new moodle_url('/course/view.php', ['id' => $course->id]);
$coursenamelink = html_writer::link($courseurl, $coursename, ['class' => $course->visible ? 'aalink' : 'aalink dimmed']);

$summarytype = get_config('theme_trema', 'summarytype');
$showcardcontact = get_config('theme_trema', 'cardcontacts');
$class = 'course-card-img';
if (empty($summarytype) && empty($showcardcontact) && empty($showcategories)) {
$class .= ' stretched-link';
}
$content = html_writer::start_tag(
'a',
[
'href' => $courseurl,
'class' => 'course-card-img',
'class' => $class,
'aria-hidden' => 'true',
'tabindex' => '-1',
'aria-label' => $coursename,
Expand Down Expand Up @@ -259,7 +265,7 @@ protected function coursecat_coursebox_content(coursecat_helper $chelper, $cours
$content .= html_writer::end_tag('div'); // End card-block.

// Display course contacts. See core_course_list_element::get_course_contacts().
if (get_config('theme_trema', 'cardcontacts') && $course->has_course_contacts()) {
if ($showcardcontact && $course->has_course_contacts()) {
$content .= html_writer::start_tag('div', ['class' => 'teachers pt-2']);
$content .= html_writer::start_tag('ul', ['class' => 'list-unstyled m-0 font-weight-light']);
foreach ($course->get_course_contacts() as $userid => $coursecontact) {
Expand Down Expand Up @@ -288,7 +294,6 @@ protected function coursecat_coursebox_content(coursecat_helper $chelper, $cours
}

// Display course summary.
$summarytype = get_config('theme_trema', 'summarytype');
if (!empty($summarytype) && ($course->has_summary())) {
if ($summarytype == 'popover') { // See more button.
$content .= html_writer::start_tag('div', ['class' => 'card-see-more text-center']);
Expand Down

0 comments on commit a1b5f74

Please sign in to comment.