Skip to content

Commit 07aa73c

Browse files
committed
attribute value classname on figures
1 parent f73e6cd commit 07aa73c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: filter.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ public function filter($text, array $options = array()) {
5353
// do the replacements
5454
foreach ($identifiers as $value => $label) {
5555
if (stripos($text, "[[units::{$label}]]") !== false) {
56-
$html = filter_units::get_units($pool, $current, $value);
56+
$html = filter_units::get_units($pool, $current, $value, $label);
5757
$text = str_ireplace("[[units::{$label}]]", $html, $text);
5858
}
5959
}
6060

6161
return $text;
6262
}
6363

64-
static function get_units($pool, $current_course, $attrib_value) {
64+
static function get_units($pool, $current_course, $attrib_value, $attrib_label = '') {
6565
global $CFG, $PAGE, $USER, $OUTPUT;
6666

6767
// filter the list of courses to just those that match the unittype value
@@ -93,7 +93,7 @@ static function get_units($pool, $current_course, $attrib_value) {
9393

9494

9595
// draw a figure / figcaption for the course
96-
$html[] = \html_writer::start_tag('figure', ['class' => 'coursebox']);
96+
$html[] = \html_writer::start_tag('figure', ['class' => 'coursebox '. strtolower($attrib_label)]);
9797
$link = new \moodle_url('/course/view.php', array('id' => $course->id));
9898
// proxy course link through an opener url that sets this page as the coursehome in the session
9999
$url = new \moodle_url('/filter/units/open.php', array('from' => $PAGE->url->out(), 'to' => $link->out(true)));

0 commit comments

Comments
 (0)