original_string: public function set_expansion_limit($type) {
          global $SITE;
          $nodes = $this->find_all_of_type($type);
  
          // We only want to hide specific types of nodes.
          // Only nodes that represent "structure" in the navigation tree should be hidden.
          // If we hide all nodes then we risk hiding vital information.
          $typestohide = array(
              self::TYPE_CATEGORY,
              self::TYPE_COURSE,
              self::TYPE_SECTION,
              self::TYPE_ACTIVITY
          );
  
          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) {
                  $child->hide($typestohide);
              }
          }
          return true;
      }
code: public function set_expansion_limit($type) {
          global $SITE;
          $nodes = $this->find_all_of_type($type);
  
          // We only want to hide specific types of nodes.
          // Only nodes that represent "structure" in the navigation tree should be hidden.
          // If we hide all nodes then we risk hiding vital information.
          $typestohide = array(
              self::TYPE_CATEGORY,
              self::TYPE_COURSE,
              self::TYPE_SECTION,
              self::TYPE_ACTIVITY
          );
  
          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) {
                  $child->hide($typestohide);
              }
          }
          return true;
      }
code_tokens: public function set_expansion_limit ( $ type ) { global $ SITE ; $ nodes = $ this -> find_all_of_type ( $ type ) ; // We only want to hide specific types of nodes. // Only nodes that represent "structure" in the navigation tree should be hidden. // If we hide all nodes then we risk hiding vital information. $ typestohide = array ( self :: TYPE_CATEGORY , self :: TYPE_COURSE , self :: TYPE_SECTION , self :: TYPE_ACTIVITY ) ; 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 ) { $ child -> hide ( $ typestohide ) ; } } return true ; }
docstring: Sets an expansion limit for the navigation
  
  The expansion limit is used to prevent the display of content that has a type
  greater than the provided $type.
  
  Can be used to ensure things such as activities or activity content don't get
  shown on the navigation.
  They are still generated in order to ensure the navbar still makes sense.
  
  @param int $type One of navigation_node::TYPE_*
  @return bool true when complete.
docstring_tokens: Sets an expansion limit for the navigation