@@ -182,7 +182,6 @@ public function load_generic_course_sections(stdClass $course, navigation_node $
182182
183183 if ($ course ->id == $ SITE ->id ) {
184184 $ this ->load_section_activities_navigation ($ coursenode , $ section , $ activities );
185- // CHANGED ABOVE: Pass section info rather than num.
186185 continue ;
187186 }
188187
@@ -203,7 +202,7 @@ public function load_generic_course_sections(stdClass $course, navigation_node $
203202
204203 // CHANGED.
205204 $ sectionname = $ format ->get_section_short_name ($ section );
206- $ url = course_get_url ( $ course , $ section, [ ' navigation ' => true ]); // CHANGED: Custom call.
205+ $ url = $ format -> get_view_url ( $ section);
207206
208207 // Add multiple nodes per section, one per level as required.
209208 // The course node already exists, so we must start below course level.
@@ -217,19 +216,19 @@ public function load_generic_course_sections(stdClass $course, navigation_node $
217216 $ parentnode = $ nodeln [$ level - 1 ]; // ADDED.
218217 $ nodeid = ($ level == $ lastlevel ) ? $ sectionid : $ extraid --; // ADDED.
219218 $ sectionnode = $ parentnode ->add (
220- $ sectionname ,
221- $ url ,
222- \navigation_node::TYPE_SECTION ,
223- null ,
224- $ nodeid ,
225- new \pix_icon (
219+ text: $ sectionname ,
220+ action: $ url ,
221+ type: navigation_node::TYPE_SECTION ,
222+ key: $ nodeid ,
223+ icon: new pix_icon (
226224 ($ sectionextra ->levelsan < FORMAT_MULTITOPIC_SECTION_LEVEL_TOPIC ) ? 'i/section ' : 'e/bullet_list ' ,
227225 ''
228226 )
229227 );
230228 // CHANGED ABOVE: Attach to parentnode with nodeid as defined above, and use a list icon for topic sections.
231- $ sectionnode ->nodetype = \ navigation_node::NODETYPE_BRANCH ;
229+ $ sectionnode ->nodetype = navigation_node::NODETYPE_BRANCH ;
232230 $ sectionnode ->hidden = (!$ section ->visible || !$ section ->available ) && ($ section ->section != 0 );
231+ $ sectionnode ->add_attribute ('data-section-name-for ' , $ section ->id );
233232 $ nodeln [$ level ] = $ sectionnode ; // ADDED.
234233 }
235234
@@ -240,9 +239,8 @@ public function load_generic_course_sections(stdClass $course, navigation_node $
240239 }
241240
242241 if (
243- ($ this ->inner ->includesectionnum !== false ) && ($ this ->inner ->includesectionnum == $ section ->section )
244- || isset ($ this ->innerincludesectionid ) && ($ this ->innerincludesectionid == $ section ->id )
245- || $ sectionextra ->hassubsections
242+ isset ($ this ->innerincludesectionid ) && ($ this ->innerincludesectionid == $ section ->id )
243+ || $ sectionextra ->hassubsections // TODO: Replace with is_section_in_breadcrumbs?
246244 // CHANGED ABOVE: Use section ID.
247245 // Also check for subsections, because activities might not get loaded otherwise.
248246 ) {
@@ -262,7 +260,7 @@ public function load_generic_course_sections(stdClass $course, navigation_node $
262260 *
263261 * @param navigation_node $sectionnode
264262 * @param section_info $section
265- * @param array $activitiesdata An array of activites as returned by see global_navigation::generate_sections_and_activities()
263+ * @param stdClass[] $activitiesdata An array of activites as returned by see global_navigation::generate_sections_and_activities()
266264 * @return stdClass[] Array of activity nodes
267265 */
268266 protected function load_section_activities_navigation (
0 commit comments