/** * @return Item */ private function createRootItem() { $rootItem = new Item('account'); $rootItem->setLabel($this->translator->trans('admin.welcome', array('%username%' => $this->tokenStorage->getToken()->getUsername()), 'FSiAdminSecurity')); $rootItem->setOptions(array('attr' => array('id' => 'account'))); return $rootItem; }
/** * @return Item */ private function createRootItem() { $translation = new Item('translation-locale'); $translation->setLabel($this->translator->trans('admin.locale.dropdown.title', array('%locale%' => $this->localeManager->getLocale()), 'FSiAdminTranslatableBundle')); $translation->setOptions(array('attr' => array('id' => 'translatable-switcher'))); return $translation; }
public function createLocaleMenu(MenuEvent $event) { if (count($this->locales) < 2) { return; } $language = new Item('admin-locale'); $language->setLabel($this->translator->trans('admin.language.current', array('%locale%' => $this->getLanguageName()), 'FSiAdminBundle')); $language->setOptions(array('attr' => array('id' => 'language'))); foreach ($this->locales as $locale) { $localeItem = new RoutableItem(sprintf('admin-locale.%s', $locale), 'fsi_admin_locale', array('_locale' => $locale, 'redirect_uri' => $this->requestStack->getMasterRequest()->getUri())); $localeItem->setLabel($this->getLanguageName($locale)); if ($locale === $this->getCurrentLocale()) { $localeItem->setOptions(array('attr' => array('class' => 'active'))); } $language->addChild($localeItem); } $event->getMenu()->addChild($language); }