From fd8b1d88a8bf1b897ee23b5e84611302d7b9e24f Mon Sep 17 00:00:00 2001 From: Laurent David Date: Tue, 19 Nov 2024 10:39:07 +0100 Subject: [PATCH] MDL-83561 format_social: Limit visible sections in social * Only the first section is visible in social format, so we limit the visibility of the section to the first section. This impacts the move dialog. --- course/format/social/lib.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/course/format/social/lib.php b/course/format/social/lib.php index c1d239b793a51..ee6517ba69cd9 100644 --- a/course/format/social/lib.php +++ b/course/format/social/lib.php @@ -170,4 +170,18 @@ public function get_max_sections() { // Social ony uses one section. return 1; } + + /** + * Returns if an specific section is visible to the current user. + * + * Formats can overrride this method to implement any special section logic. + * + * @param section_info $section the section modinfo + * @return bool; + */ + #[\Override] + public function is_section_visible(section_info $section): bool { + $visible = parent::is_section_visible($section); + return $visible && $section->section == 0; + } }