@@ -1018,6 +1018,7 @@ public function get_default_blocks(): array {
10181018 * @return array of options
10191019 */
10201020 public function course_format_options ($ foreditform = false ): array {
1021+ global $ CFG ; // ADDED.
10211022 static $ courseformatoptions = false ;
10221023 if ($ courseformatoptions === false ) {
10231024 $ courseconfig = get_config ('moodlecourse ' );
@@ -1048,6 +1049,23 @@ public function course_format_options($foreditform = false): array {
10481049 ];
10491050 }
10501051 if ($ foreditform && !isset ($ courseformatoptions ['hiddensections ' ]['label ' ])) { // CHANGED.
1052+ $ hiddensectionslist = new core \output \choicelist ();
1053+ $ hiddensectionslist ->set_allow_empty (false );
1054+ $ hiddensectionslist ->add_option (
1055+ 1 ,
1056+ new lang_string ('hiddensectionsinvisible ' ),
1057+ [
1058+ 'description ' => new lang_string ('hiddensectionsinvisible_description ' ),
1059+ ],
1060+ );
1061+ $ hiddensectionslist ->add_option (
1062+ 0 ,
1063+ new lang_string ('hiddensectionscollapsed ' ),
1064+ [
1065+ 'description ' => new lang_string ('hiddensectionscollapsed_description ' ),
1066+ ],
1067+ );
1068+
10511069 $ courseformatoptionsedit = [
10521070 // INCLUDED /course/format/periods/lib.php function course_format_options $foreditform 'periodduration' .
10531071 'periodduration ' => [
@@ -1079,7 +1097,7 @@ public function course_format_options($foreditform = false): array {
10791097 'help_component ' => 'format_multitopic ' ,
10801098 ],
10811099 // END ADDED.
1082- 'hiddensections ' => [
1100+ 'hiddensections ' => ( $ CFG -> version < 2025082900 ) ? [
10831101 'label ' => new lang_string ('hiddensections ' ),
10841102 'help ' => 'hiddensections ' ,
10851103 'help_component ' => 'moodle ' ,
@@ -1090,6 +1108,12 @@ public function course_format_options($foreditform = false): array {
10901108 1 => new lang_string ('hiddensectionsinvisible ' ),
10911109 ],
10921110 ],
1111+ ] : [
1112+ 'label ' => new lang_string ('hiddensections ' ),
1113+ 'element_type ' => 'choicedropdown ' ,
1114+ 'element_attributes ' => [
1115+ $ hiddensectionslist ,
1116+ ],
10931117 ],
10941118 // REMOVED: coursedisplay .
10951119 // ADDED.
0 commit comments