mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-73895 message: hide empty component notification categories.
If a component has no available notification types (because they're disabled), then it (the component) should be hidden entirely from the user notification preferences page.
This commit is contained in:
parent
d24a4ab56f
commit
44ce37902d
@ -161,6 +161,8 @@ class notification_list_component implements templatable, renderable {
|
||||
$context['notifications'][] = $notificationcontext;
|
||||
}
|
||||
|
||||
$context['hasnotifications'] = (count($context['notifications']) > 0);
|
||||
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
{
|
||||
"displayname": "System",
|
||||
"colspan": 2,
|
||||
"hasnotifications": 1,
|
||||
"notifications": [
|
||||
{
|
||||
"displayname": "Notices about minor problems",
|
||||
|
@ -27,13 +27,15 @@
|
||||
|
||||
Context variables required for this template:
|
||||
* displayname The component display name
|
||||
* processors The list of processors for this component
|
||||
* colspan The number of columns the row should span
|
||||
* hasnotifications Whether any notifications exist
|
||||
* notifications The list of notifications
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"displayname": "System",
|
||||
"colspan": 2,
|
||||
"hasnotifications": 1,
|
||||
"notifications": [
|
||||
{
|
||||
"displayname": "Notices about minor problems",
|
||||
@ -52,9 +54,11 @@
|
||||
]
|
||||
}
|
||||
}}
|
||||
<tr>
|
||||
<th colspan="{{{colspan}}}">{{{displayname}}}</th>
|
||||
</tr>
|
||||
{{#notifications}}
|
||||
{{> message/notification_preferences_component_notification }}
|
||||
{{/notifications}}
|
||||
{{#hasnotifications}}
|
||||
<tr>
|
||||
<th colspan="{{{colspan}}}">{{{displayname}}}</th>
|
||||
</tr>
|
||||
{{#notifications}}
|
||||
{{> message/notification_preferences_component_notification }}
|
||||
{{/notifications}}
|
||||
{{/hasnotifications}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user