Skip to content

Commit

Permalink
improving helper and info-block
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed Sep 7, 2016
1 parent 9d20270 commit 7cb21c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions components/com_content/helpers/association.php
Expand Up @@ -70,17 +70,17 @@ public static function getAssociations($id = 0, $view = null)
*
* @since __DEPLOY_VERSION__
*/
public static function displayAssociations($id = 0)
public static function displayAssociations($id)
{
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_content');
$url_assoc = '';
$associations = self::getAssociations($id);

$levels = JFactory::getUser()->getAuthorisedViewLevels();
$languages = JLanguageHelper::getLanguages();

if (self::getAssociations($id) != null)
if (!empty($associations))
{
$associations = self::getAssociations($id);
jimport('joomla.application.component.helper');
$params = JComponentHelper::getParams('com_content');
$levels = JFactory::getUser()->getAuthorisedViewLevels();
$languages = JLanguageHelper::getLanguages();

foreach ($associations as $key => $value)
{
Expand All @@ -103,23 +103,23 @@ public static function displayAssociations($id = 0)
}
elseif (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;' . JRoute::_('<a href="' . JRoute::_($value) . '">' . $flag . '</a>') . '&nbsp;';
}
else
{
$class = 'label label-association label-' . $language->sef;
$url = '&nbsp;' . JRoute::_('<a class="' . $class . '" href="' . JRoute::_($value) . '">' . strtoupper($language->sef) . '</a>') . '&nbsp;';
$url = '&nbsp;<a href="' . JRoute::_($value) . '">' . $flag . '</a>&nbsp;';
}

echo $url;
$url_assoc .= $url;
}
}
}
}

return $url_assoc;
}
}
2 changes: 1 addition & 1 deletion layouts/joomla/content/info_block/associations.php
Expand Up @@ -11,7 +11,7 @@
JLoader::register('ContentHelperAssociation', JPATH_SITE . '/components/com_content/helpers/association.php');
$id = $displayData['item']->id;
?>
<?php if (ContentHelperAssociation::getAssociations($id) != null) : ?>
<?php if (ContentHelperAssociation::displayAssociations($id) != null) : ?>
<dd class="association">
<?php echo JText::_('JASSOCIATIONS'); ?>
<?php echo ContentHelperAssociation::displayAssociations($id); ?>
Expand Down

0 comments on commit 7cb21c4

Please sign in to comment.