Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-33013 navigation: fixed expansion limit issue hiding nodes

  • Loading branch information...
commit ba7b1ca565c8a59a54bddf7a89881bac2256cff1 1 parent cce0d9a
Sam Hemelryk authored February 19, 2013

Showing 1 changed file with 17 additions and 3 deletions. Show diff stats Hide diff stats

  1. 20  lib/navigationlib.php
20  lib/navigationlib.php
@@ -672,6 +672,20 @@ public function set_parent(navigation_node $parent) {
672 672
             $this->parent->make_inactive();
673 673
         }
674 674
     }
  675
+
  676
+    /**
  677
+     * Hides the node and any children it has.
  678
+     *
  679
+     * @since 2.5
  680
+     */
  681
+    public function hide() {
  682
+        $this->display = false;
  683
+        if ($this->has_children()) {
  684
+            foreach ($this->children as $child) {
  685
+                $child->hide();
  686
+            }
  687
+        }
  688
+    }
675 689
 }
676 690
 
677 691
 /**
@@ -2492,18 +2506,18 @@ public function clear_cache() {
2492 2506
     public function set_expansion_limit($type) {
2493 2507
         global $SITE;
2494 2508
         $nodes = $this->find_all_of_type($type);
2495  
-        foreach ($nodes as &$node) {
  2509
+        foreach ($nodes as $node) {
2496 2510
             // We need to generate the full site node
2497 2511
             if ($type == self::TYPE_COURSE && $node->key == $SITE->id) {
2498 2512
                 continue;
2499 2513
             }
2500  
-            foreach ($node->children as &$child) {
  2514
+            foreach ($node->children as $child) {
2501 2515
                 // We still want to show course reports and participants containers
2502 2516
                 // or there will be navigation missing.
2503 2517
                 if ($type == self::TYPE_COURSE && $child->type === self::TYPE_CONTAINER) {
2504 2518
                     continue;
2505 2519
                 }
2506  
-                $child->display = false;
  2520
+                $child->hide();
2507 2521
             }
2508 2522
         }
2509 2523
         return true;

0 notes on commit ba7b1ca

Please sign in to comment.
Something went wrong with that request. Please try again.