Commit a109418 1 parent 328b48e commit a109418 Copy full SHA for a109418
File tree 5 files changed +24
-2
lines changed
5 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 104
104
);
105
105
106
106
$ courseformat = course_get_format ($ course );
107
- $ defaultsectionname = $ courseformat ->get_default_section_name ( $ section );
107
+ $ defaultsectionname = $ courseformat ->get_new_section_name ( $ section -> section );
108
108
109
109
$ customdata = [
110
110
'cs ' => $ sectioninfo ,
Original file line number Diff line number Diff line change @@ -552,6 +552,16 @@ public function get_default_section_name($section) {
552
552
return self ::get_section_name ($ section );
553
553
}
554
554
555
+ /**
556
+ * Retrieves the name for a new section.
557
+ *
558
+ * @param int $sectionnum The section number.
559
+ * @return string The name for the new section.
560
+ */
561
+ public function get_new_section_name (int $ sectionnum ) {
562
+ return $ this ->get_default_section_name ($ sectionnum );
563
+ }
564
+
555
565
/**
556
566
* Returns the name for the highlighted section.
557
567
*
Original file line number Diff line number Diff line change 24
24
25
25
$ string ['currentsection ' ] = 'Current section ' ;
26
26
$ string ['hidefromothers ' ] = 'Hide ' ;
27
+ $ string ['newsection ' ] = 'New section ' ;
27
28
$ string ['page-course-view-topics ' ] = 'Any course main page in custom sections format ' ;
28
29
$ string ['page-course-view-topics-x ' ] = 'Any course page in custom sections format ' ;
29
30
$ string ['pluginname ' ] = 'Custom sections ' ;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public function get_section_name($section) {
68
68
return format_string ($ section ->name , true ,
69
69
['context ' => context_course::instance ($ this ->courseid )]);
70
70
} else {
71
- return $ this ->get_default_section_name ($ section );
71
+ return $ this ->get_new_section_name ($ section-> sectionnum );
72
72
}
73
73
}
74
74
@@ -83,6 +83,7 @@ public function get_section_name($section) {
83
83
* @return string The default value for the section name.
84
84
*/
85
85
public function get_default_section_name ($ section ) {
86
+ $ section = $ this ->get_section ($ section );
86
87
if ($ section ->section == 0 ) {
87
88
// Return the general section.
88
89
return get_string ('section0name ' , 'format_topics ' );
@@ -93,6 +94,15 @@ public function get_default_section_name($section) {
93
94
}
94
95
}
95
96
97
+ #[Override]
98
+ public function get_new_section_name (int $ sectionnum ) {
99
+ if ($ sectionnum == 0 ) {
100
+ return get_string ('section0name ' , 'format_topics ' );
101
+ }
102
+
103
+ return get_string ('newsection ' , 'format_topics ' );
104
+ }
105
+
96
106
/**
97
107
* Generate the title for this section page.
98
108
*
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ public function get_section_name($section) {
87
87
* @return string The default value for the section name.
88
88
*/
89
89
public function get_default_section_name ($ section ) {
90
+ $ section = $ this ->get_section ($ section );
90
91
if ($ section ->section == 0 ) {
91
92
// Return the general section.
92
93
return get_string ('section0name ' , 'format_weeks ' );
You can’t perform that action at this time.
0 commit comments