MDL-58048 mod: New callback implementation
* Callback function implementation of <modname>_core_calendar_event_action_shows_item_count for: - mod_assign - mod_forum Part of MDL-55611 epic.
This commit is contained in:
committed by
Damyon Wiese
parent
fe75ef33ee
commit
fb36d8dd2c
@@ -1772,3 +1772,20 @@ function mod_assign_core_calendar_provide_event_action(\core_calendar\event $eve
|
||||
$actionable
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function that determines whether an action event should be showing its item count
|
||||
* based on the event type and the item count.
|
||||
*
|
||||
* @param \core_calendar\event $event The calendar event.
|
||||
* @param int $itemcount The item count associated with the action event.
|
||||
* @return bool
|
||||
*/
|
||||
function mod_assign_core_calendar_event_action_shows_item_count(\core_calendar\event $event, $itemcount = 0) {
|
||||
// List of event types where the action event's item count should be shown.
|
||||
$eventtypesshowingitemcount = [
|
||||
ASSIGN_EVENT_TYPE_GRADINGDUE
|
||||
];
|
||||
// For mod_assign, item count should be shown if the event type is 'gradingdue' and there is one or more item count.
|
||||
return in_array($event->eventtype, $eventtypesshowingitemcount) && $itemcount > 0;
|
||||
}
|
||||
|
||||
@@ -8116,3 +8116,16 @@ function mod_forum_get_fontawesome_icon_map() {
|
||||
'mod_forum:t/unsubscribed' => 'fa-envelope-open-o',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function that determines whether an action event should be showing its item count
|
||||
* based on the event type and the item count.
|
||||
*
|
||||
* @param \core_calendar\event $event The calendar event.
|
||||
* @param int $itemcount The item count associated with the action event.
|
||||
* @return bool
|
||||
*/
|
||||
function mod_forum_core_calendar_event_action_shows_item_count(\core_calendar\event $event, $itemcount = 0) {
|
||||
// Always show item count for forums if item count is greater than 0.
|
||||
return $itemcount > 0;
|
||||
}
|
||||
Reference in New Issue
Block a user