protected function fillMenu(ItemInterface $menu, $categories, array $options = array(), $currentUri = null)
{
foreach ($categories as $category) {
if (false === $category->getEnabled()) {
continue;
}
$fullOptions = array_merge(array('attributes' => array('class' => ''), 'route' => 'sonata_catalog_category', 'routeParameters' => array('category_id' => $category->getId(), 'category_slug' => $category->getSlug()), 'extras' => array('safe_label' => true)), $options);
if (null === $category->getParent()) {
$fullOptions['attributes']['class'] = 'lead ' . $fullOptions['attributes']['class'];
}
$child = $menu->addChild($this->getCategoryTitle($category), $fullOptions);
if (count($category->getChildren()) > 0) {
if (null === $category->getParent()) {
$this->fillMenu($menu, $category->getChildren(), $options, $currentUri);
} else {
$this->fillMenu($child, $category->getChildren(), $options, $currentUri);
}
}
}
}