Skip to content

Commit b9803e4

Browse files
committed
Detect button::BODY_OUTLINE reliably.
1 parent 5f1d0cf commit b9803e4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

classes/courseformat/overview.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,21 @@ public function get_actions_overview(): ?overviewitem {
9191

9292
$currentanswerscount = $this->manager->count_all_users_answered();
9393

94+
95+
if (
96+
class_exists(button::class) &&
97+
(new \ReflectionClass(button::class))->hasConstant('BODY_OUTLINE')
98+
) {
99+
$bodyoutline = button::BODY_OUTLINE;
100+
$buttonclass = $bodyoutline->classes();
101+
} else {
102+
$buttonclass = "btn btn-outline-secondary";
103+
}
104+
94105
$content = new action_link(
95106
url: new \moodle_url('/mod/questionnaire/report.php', ['instance' => $this->cm->instance]),
96107
text: get_string('view', 'core'),
97-
attributes: ['class' => button::SECONDARY_OUTLINE->classes()],
108+
attributes: ['class' => $buttonclass],
98109
);
99110

100111
return new overviewitem(

0 commit comments

Comments
 (0)