/** * Sets the language placeholders in the provided template * @param \Cx\Core\Routing\Url $pageUrl * @param \Cx\Core\Html\Sigma $objTemplate */ public function setLanguagePlaceholders($page, $pageUrl, $objTemplate) { $activeLanguages = \FWLanguage::getActiveFrontendLanguages(); $node = $page->getNode(); $placeholders = array(); foreach ($activeLanguages as $langId => $langData) { $url = clone $pageUrl; $url->setLangDir($langData['lang']); if (($targetPage = $node->getPage($langId)) && $targetPage->isActive()) { $url->setPath(substr($targetPage->getPath(), 1)); $link = $url->__toString(); } else { $link = $url->fromModuleAndCmd('Error', '', $langId); } $placeholders['LANG_CHANGE_' . strtoupper($langData['lang'])] = $link; $placeholders['LANG_SELECTED_' . strtoupper($langData['lang'])] = ''; } $placeholders['LANG_SELECTED_' . strtoupper($pageUrl->getLangDir())] = 'selected'; $objTemplate->setVariable($placeholders); }