public function testGetAllLocalizationsWithSameLocalizations() { $localization1 = new Localization(); $localization1->setLanguage('de'); $localization2 = new Localization(); $localization2->setLanguage('en'); $this->addLocalizationProvider([$localization1, $localization2]); $this->addLocalizationProvider([$localization2]); $localizations = $this->localizationManager->getLocalizations(); $this->assertCount(2, $localizations); $this->assertContains($localization1, $localizations); $this->assertContains($localization2, $localizations); }
/** * Iterates over all nodes of the given type, and upgrades them. * * @param StructureMetadata $structureMetadata The structure metadata, whose pages have to be upgraded * @param array $properties The properties which are or contain URL fields * @param bool $addScheme Adds the scheme to URLs if true, removes the scheme otherwise */ private function iterateStructureNodes(StructureMetadata $structureMetadata, array $properties, $addScheme) { foreach ($this->localizationManager->getLocalizations() as $localization) { $rows = $this->session->getWorkspace()->getQueryManager()->createQuery(sprintf('SELECT * FROM [nt:unstructured] WHERE [%s] = "%s" OR [%s] = "%s"', $this->propertyEncoder->localizedSystemName('template', $localization->getLocalization()), $structureMetadata->getName(), 'template', $structureMetadata->getName()), 'JCR-SQL2')->execute(); foreach ($rows->getNodes() as $node) { $this->upgradeNode($node, $localization->getLocalization(), $properties, $addScheme); } } }
/** * Renders admin ui. * * @return \Symfony\Component\HttpFoundation\Response */ public function indexAction() { if (!$this->authorizationChecker->isGranted('IS_AUTHENTICATED_REMEMBERED')) { return new RedirectResponse($this->urlGenerator->generate('sulu_admin.login', [])); } $user = $this->tokenStorage->getToken()->getUser(); // get js config from bundles $jsConfig = $this->jsConfigPool->getConfigParams(); // render template if ($this->environment === 'dev') { $template = 'SuluAdminBundle:Admin:index.html.twig'; } else { $template = 'SuluAdminBundle:Admin:index.html.dist.twig'; } return $this->engine->renderResponse($template, ['name' => $this->adminName, 'locales' => array_keys($this->localizationManager->getLocalizations()), 'translated_locales' => $this->translatedLocales, 'translations' => $this->translations, 'fallback_locale' => $this->fallbackLocale, 'suluVersion' => $this->suluVersion, 'user' => $this->serializer->serialize($user, 'array', SerializationContext::create()->setGroups(['frontend'])), 'config' => $jsConfig]); }