- md5
- 1f644b2e816da4cca95094cccebfdb10
- sha1
- 0ec5a93002675e9295150bad3205428f6b434fe3
- sha256
- 170bbdef752643a092e45a54c5cc8252b2b6d98a71148f14c0328f3ff4b4d6bf
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
<?php
/**
* @package Joomla.Site
* @subpackage com_contact
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Contact\Site\Helper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Associations;
use Joomla\Component\Categories\Administrator\Helper\CategoryAssociationHelper;
/**
* Contact Component Association Helper
*
* @since 3.0
*/
abstract class AssociationHelper extends CategoryAssociationHelper
{
/**
* Method to get the associations for a given item
*
* @param integer $id Id of the item
* @param string $view Name of the view
*
* @return array Array of associations for the item
*
* @since 3.0
*/
public static function getAssociations($id = 0, $view = null)
{
$jinput = Factory::getApplication()->input;
$view = $view ?? $jinput->get('view');
$id = empty($id) ? $jinput->getInt('id') : $id;
if ($view === 'contact') {
if ($id) {
$associations = Associations::getAssociations('com_contact', '#__contact_details', 'com_contact.item', $id);
$return = array();
foreach ($associations as $tag => $item) {
$return[$tag] = RouteHelper::getContactRoute($item->id, (int) $item->catid, $item->language);
}
return $return;
}
}
if ($view === 'category' || $view === 'categories') {
return self::getCategoryAssociations($id, 'com_contact');
}
return array();
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.