original_string: protected function _render($items, $depth = 0)
      {
          $content = '';
          $formatter = $this->config('formatter');
  
          foreach ($items as $item) {
              $children = '';
              if (is_array($item)) {
                  $item = new Entity($item);
              }
  
              if ($item->has('children') && !empty($item->children) && $item->expanded) {
                  $children = $this->formatTemplate('parent', [
                      'attrs' => $this->templater()->formatAttributes([
                          'class' => ($this->config('dropdown') ? 'dropdown-menu multi-level' : ''),
                          'role' => 'menu'
                      ]),
                      'content' => $this->_render($item->children, $depth + 1)
                  ]);
              }
  
              $this->_index++;
              $info = [
                  'index' => $this->_index,
                  'total' => $this->_count,
                  'active' => $this->Link->isActive($item),
                  'depth' => $depth,
                  'hasChildren' => !empty($children),
                  'children' => $children,
              ];
              $content .= $formatter($item, $info);
          }
  
          return $content;
      }
code: protected function _render($items, $depth = 0)
      {
          $content = '';
          $formatter = $this->config('formatter');
  
          foreach ($items as $item) {
              $children = '';
              if (is_array($item)) {
                  $item = new Entity($item);
              }
  
              if ($item->has('children') && !empty($item->children) && $item->expanded) {
                  $children = $this->formatTemplate('parent', [
                      'attrs' => $this->templater()->formatAttributes([
                          'class' => ($this->config('dropdown') ? 'dropdown-menu multi-level' : ''),
                          'role' => 'menu'
                      ]),
                      'content' => $this->_render($item->children, $depth + 1)
                  ]);
              }
  
              $this->_index++;
              $info = [
                  'index' => $this->_index,
                  'total' => $this->_count,
                  'active' => $this->Link->isActive($item),
                  'depth' => $depth,
                  'hasChildren' => !empty($children),
                  'children' => $children,
              ];
              $content .= $formatter($item, $info);
          }
  
          return $content;
      }
code_tokens: protected function _render ( $ items , $ depth = 0 ) { $ content = '' ; $ formatter = $ this -> config ( 'formatter' ) ; foreach ( $ items as $ item ) { $ children = '' ; if ( is_array ( $ item ) ) { $ item = new Entity ( $ item ) ; } if ( $ item -> has ( 'children' ) && ! empty ( $ item -> children ) && $ item -> expanded ) { $ children = $ this -> formatTemplate ( 'parent' , [ 'attrs' => $ this -> templater ( ) -> formatAttributes ( [ 'class' => ( $ this -> config ( 'dropdown' ) ? 'dropdown-menu multi-level' : '' ) , 'role' => 'menu' ] ) , 'content' => $ this -> _render ( $ item -> children , $ depth + 1 ) ] ) ; } $ this -> _index ++ ; $ info = [ 'index' => $ this -> _index , 'total' => $ this -> _count , 'active' => $ this -> Link -> isActive ( $ item ) , 'depth' => $ depth , 'hasChildren' => ! empty ( $ children ) , 'children' => $ children , ] ; $ content .= $ formatter ( $ item , $ info ) ; } return $ content ; }
docstring: Internal method to recursively generate the menu.
  
  @param \Cake\ORM\Query $items Items to render
  @param int $depth Current iteration depth
  @return string HTML
docstring_tokens: Internal method to recursively generate the menu .