Skip to content

Commit ce0437d

Browse files
add the icon using css
Signed-off-by: Diego Andrés <diegoandres_cortes@outlook.com>
1 parent 65913a2 commit ce0437d

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Sources/Quiz/Integration.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public static function init()
1818
add_integration_function('integrate_load_permissions', __CLASS__ . '::permissions', false);
1919
add_integration_function('integrate_load_illegal_guest_permissions', __CLASS__ . '::illegal_guest_permissions', false);
2020
add_integration_function('integrate_load_permissions', __CLASS__ . '::permissions', false);
21+
add_integration_function('integrate_pre_css_output', __CLASS__ . '::preCSS', false);
2122
}
2223

2324
public static function setVersion()
@@ -130,7 +131,7 @@ public static function menu_buttons(&$buttons)
130131
$temp_buttons['SMFQuiz'] = array(
131132
'title' => $txt['SMFQuiz'],
132133
'href' => $scripturl . '?action=SMFQuiz',
133-
'icon' => 'icons/quiz.png',
134+
'icon' => 'quiz',
134135
'show' => allowedTo('quiz_view') && !empty($modSettings['SMFQuiz_enabled']),
135136
'sub_buttons' => array(),
136137
);
@@ -139,4 +140,18 @@ public static function menu_buttons(&$buttons)
139140
}
140141
$buttons = $temp_buttons;
141142
}
143+
144+
public static function preCSS()
145+
{
146+
global $settings;
147+
148+
// Add the icon using inline css
149+
addInlineCss('
150+
.main_icons.quiz::before {
151+
background-position: 0;
152+
background-image: url("' . $settings['default_images_url'] . '/icons/quiz.png");
153+
background-size: contain;
154+
}
155+
');
156+
}
142157
}

0 commit comments

Comments
 (0)