Skip to content

Instantly share code, notes, and snippets.

@Kubik-Rubik
Last active September 6, 2016 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kubik-Rubik/901591e750e26ad9a0ca3fe0a9a08112 to your computer and use it in GitHub Desktop.
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
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 = '&nbsp;<a class="' . $class . '" href="' . JRoute::_($value) . '">' . strtoupper($language->sef) . '</a>&nbsp;';
if ($params->get('flags', 1))
{
$flag = JHtml::_('image', 'mod_languages/' . $language->image . '.gif', $language->title_native, array('title' => $language->title_native), true);
$url = '&nbsp;<a href="' . JRoute::_($value) . '">' . $flag . '</a>&nbsp;';
}
$url_assoc .= $url;
}
}
}
}
return $url_assoc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment