You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: "Activity icons are used to quickly identify the activty types"
5
-
date: 2020-01-14T16:32:24+01:00
4
+
description: "Activity icons are used to quickly identify the activity types"
6
5
draft: false
7
6
weight: 5
8
7
toc: true
9
8
tags:
10
9
- Available
11
10
- '4.0'
11
+
- Updated
12
+
- '4.4'
12
13
---
13
14
14
15
## Activity icon types
15
16
16
-
Moodle activity icons are single black svg icons that is stored in mod/PLUGINNAME/pix/icon.svg.
17
+
Moodle activity icons are single black SVG icons that are stored in `mod/PLUGINNAME/pix/monologo.svg`.
17
18
18
19
### Minimal activity icons
19
-
When rendered in a page with limited space the icons will be shown in their original design, for example on the course gradebook where activity show in the grade table header. Note: the icon is using the ```.icon``` css class for sizing.
20
20
21
+
When rendered in a page with limited space the icons will be shown in their original design, for example on the course gradebook where activity show in the grade table header.
22
+
23
+
> NOTE: The icon is using the ```.icon``` CSS class which limits the maximum width and height. It's recommended to define width and height into the SVG.
In places like the course page and the activity chooser icons have a more prominent role and they should be rendered on a coloured background in white.
34
+
35
+
In places like the course page and the activity chooser icons have a more prominent role and they should be rendered outlined colored against a transparent background.
29
36
30
37
The CSS classes for these icons are ```activityiconcontainer``` wrapper class with the added activity name. And the ```activityicon``` class for the image. See the template ```course/format/templates/local/content/cm/title.mustache``` for more info.
In the HTML for the example above you might notice the ```assessment``` css class after ```.activityiconcontainer```. This class is the result of assigning a *purpose* to the quiz activity in ```/mod/quiz/lib.php```.
45
51
46
52
{{< php >}}
@@ -54,34 +60,47 @@ function quiz_supports($feature) {
54
60
}
55
61
{{< /php >}}
56
62
57
-
The available activity purposes are:
63
+
Since Moodle 4.4, the available activity purposes are:
each defined as 'MOD_PURPOSE_X', so Assessment is MOD_PURPOSE_ASSESSMENT.
73
+
> NOTE: On Moodle 4.3 downwards, MOD_PURPOSE_INTERFACE was also available, but it has been deprecated, so it's not recommended to use it.
68
74
69
75
### Purpose colours
70
76
71
-
The activity icon colours can be customised using the theme Boost 'Raw initial SCSS' feature. Simply copy any of these scss variables that you want to customize, change the colour valueand done! There is no background colour for the 'Other' type purpose, it defaults to ```light-grey: #f8f9fa```.
77
+
The activity icon colours can be customised using the theme Boost 'Raw initial SCSS' feature. Simply copy any of these scss variables that you want to customize, change the colour value, generate the filter using, for instance https://codepen.io/sosuke/pen/Pjoqqpand done! There is no background colour or filter for the 'Other' or the 'Interface' purposes.
Some activities allow icons to be customised. This can be done by implementing callback XXX_get_coursemodule_info() returning instance of object e.g. mod/lti/lib.php
103
+
Some activities allow icons to be customised. This can be done by implementing callback `XXX_get_coursemodule_info()` returning instance of object (for instance, `mod/lti/lib.php`).
Since Moodle 4.4, a new callback has been added to the modules. Branded icons are displayed with their original colours and they are not affected by the activity purpose colours.
128
+
129
+
{{< php >}}
130
+
/**
131
+
* Whether the activity is branded.
132
+
* This information is used, for instance, to decide if a filter should be applied to the icon or not.
133
+
*
134
+
*@return bool True if the activity is branded, false otherwise.
0 commit comments