|
@@ 52-62 (lines=11) @@
|
| 49 |
|
* @param string $uri |
| 50 |
|
* @return ItemInterface Link element |
| 51 |
|
*/ |
| 52 |
|
protected function addLinkURI(ItemInterface $menu, $label, $uri) |
| 53 |
|
{ |
| 54 |
|
$item = $menu->addChild($label, array('uri' => $uri)); |
| 55 |
|
$item->setExtra('translation_domain', $this->translation_domain); |
| 56 |
|
|
| 57 |
|
if ($this->isCurrentUri($item->getUri())) { |
| 58 |
|
$item->setAttribute('class', 'active'); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
return $item; |
| 62 |
|
} |
| 63 |
|
|
| 64 |
|
/** |
| 65 |
|
* Creates link to route element and adds it to menu |
|
@@ 73-83 (lines=11) @@
|
| 70 |
|
* @param array $routeParameters Route parameters |
| 71 |
|
* @return ItemInterface Link element |
| 72 |
|
*/ |
| 73 |
|
protected function addLinkRoute(ItemInterface $menu, $label, $route, $routeParameters = array()) |
| 74 |
|
{ |
| 75 |
|
$item = $menu->addChild($label, array('route' => $route, 'routeParameters' => $routeParameters, 'routeAbsolute' => UrlGeneratorInterface::ABSOLUTE_PATH)); |
| 76 |
|
$item->setExtra('translation_domain', $this->translation_domain); |
| 77 |
|
|
| 78 |
|
if ($this->isCurrentUri($item->getUri())) { |
| 79 |
|
$this->setActive($item); |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
return $item; |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
/** |
| 86 |
|
* Set active class to current item and all its parents (so it is automatically opened) |