Last active
September 6, 2016 14:10
-
-
Save Kubik-Rubik/901591e750e26ad9a0ca3fe0a9a08112 to your computer and use it in GitHub Desktop.
New Feature, Multilanguage: Add the possibility of displaying associations in article info and in articles list #11935 - https://github.com/joomla/joomla-cms/pull/11935
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function displayAssociations($id = 0) | |
{ | |
$url_assoc = ''; | |
$associations = self::getAssociations($id); | |
if (!empty($associations)) | |
{ | |
jimport('joomla.application.component.helper'); | |
$params = JComponentHelper::getParams('com_content'); | |
$languages = JLanguageHelper::getLanguages(); | |
foreach ($associations as $key => $value) | |
{ | |
foreach ($languages as $language) | |
{ | |
if (isset($key) && ($key == $language->lang_code)) | |
{ | |
$class = 'label label-association label-' . $language->sef; | |
$url = ' <a class="' . $class . '" href="' . JRoute::_($value) . '">' . strtoupper($language->sef) . '</a> '; | |
if ($params->get('flags', 1)) | |
{ | |
$flag = JHtml::_('image', 'mod_languages/' . $language->image . '.gif', $language->title_native, array('title' => $language->title_native), true); | |
$url = ' <a href="' . JRoute::_($value) . '">' . $flag . '</a> '; | |
} | |
$url_assoc .= $url; | |
} | |
} | |
} | |
} | |
return $url_assoc; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment