public function renderLanguagesMenu() : string
 {
     $pages = $this->config['lang_menu'] ?? [];
     $listElements = [];
     $elementPattern = '<li><a href="%s">%s</a></li>';
     $pageResult = $this->routeAssembler->getCurrentRouteResult();
     foreach ($pages as $page) {
         // Inherit current route if it is not an error page
         $routeName = $pageResult->isSuccess() ? null : 'home';
         $route = $this->routeAssembler->assembleUrl($routeName, $page['params']);
         $listElements[] = sprintf($elementPattern, $route, $page['label']);
     }
     return sprintf('<ul class="pull-right right-menu">%s</ul>', implode('', $listElements));
 }
Пример #2
0
 /**
  * @return RouteResult
  */
 public function getCurrentRouteResult()
 {
     return $this->routeAssembler->getCurrentRouteResult();
 }