protected function renderList(ItemInterface $item, array $attributes, array $options) { /** * Return an empty string if any of the following are true: * a) The menu has no children eligible to be displayed * b) The depth is 0 * c) This menu item has been explicitly set to hide its children */ if (!$item->hasChildren() || 0 === $options['depth'] || !$item->getDisplayChildren()) { return ''; } $html = $this->format('<ul' . $this->renderHtmlAttributes($attributes) . '>', 'ul', $item->getLevel(), $options); $html .= $this->renderChildren($item, $options); $html .= $this->format('</ul>', 'ul', $item->getLevel(), $options); return $html; }