Permalink
Browse files

Merge branch 'wip-MDL-33013-m23' of git://github.com/samhemelryk/mood…

…le into MOODLE_23_STABLE
  • Loading branch information...
2 parents 48f3a24 + 240a2ee commit a366e1282abe449f3e244365802f7922fe66ad1b @stronk7 stronk7 committed Mar 4, 2013
Showing with 17 additions and 3 deletions.
  1. +17 −3 lib/navigationlib.php
View
@@ -662,6 +662,20 @@ public function set_parent(navigation_node $parent) {
$this->parent->make_inactive();
}
}
+
+ /**
+ * Hides the node and any children it has.
+ *
+ * @since 2.3.5
+ */
+ public function hide() {
+ $this->display = false;
+ if ($this->has_children()) {
+ foreach ($this->children as $child) {
+ $child->hide();
+ }
+ }
+ }
}
/**
@@ -2728,18 +2742,18 @@ public function clear_cache() {
public function set_expansion_limit($type) {
global $SITE;
$nodes = $this->find_all_of_type($type);
- foreach ($nodes as &$node) {
+ foreach ($nodes as $node) {
// We need to generate the full site node
if ($type == self::TYPE_COURSE && $node->key == $SITE->id) {
continue;
}
- foreach ($node->children as &$child) {
+ foreach ($node->children as $child) {
// We still want to show course reports and participants containers
// or there will be navigation missing.
if ($type == self::TYPE_COURSE && $child->type === self::TYPE_CONTAINER) {
continue;
}
- $child->display = false;
+ $child->hide();
}
}
return true;

0 comments on commit a366e12

Please sign in to comment.