Source for file association.php

Documentation is available at association.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_categories
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. JLoader::register('CategoriesHelper'JPATH_ADMINISTRATOR '/components/com_categories/helpers/categories.php');
  13.  
  14. /**
  15.  * Category Component Association Helper
  16.  *
  17.  * @package     Joomla.Site
  18.  * @subpackage  com_categories
  19.  * @since       3.0
  20.  */
  21. abstract class CategoryHelperAssociation
  22. {
  23.     public static $category_association true;
  24.  
  25.     /**
  26.      * Method to get the associations for a given category
  27.      *
  28.      * @param   integer  $id         Id of the item
  29.      * @param   string   $extension  Name of the component
  30.      *
  31.      * @return  array    Array of associations for the component categories
  32.      *
  33.      * @since  3.0
  34.      */
  35.  
  36.     public static function getCategoryAssociations($id 0$extension 'com_content')
  37.     {
  38.         $return array();
  39.  
  40.         if ($id)
  41.         {
  42.             // Load route helper
  43.             jimport('helper.route'JPATH_COMPONENT_SITE);
  44.             $helperClassname ucfirst(substr($extension4)) 'HelperRoute';
  45.  
  46.             $associations CategoriesHelper::getAssociations($id$extension);
  47.             foreach ($associations as $tag => $item)
  48.             {
  49.                 if (class_exists($helperClassname&& is_callable(array($helperClassname'getCategoryRoute')))
  50.                 {
  51.                     $return[$tag$helperClassname::getCategoryRoute($item$tag);
  52.                 }
  53.                 else
  54.                 {
  55.                     $return[$tag'index.php?option=' $extension '&view=category&id=' $item;
  56.                 }
  57.             }
  58.         }
  59.  
  60.         return $return;
  61.     }
  62. }

Documentation generated on Tue, 19 Nov 2013 14:54:06 +0100 by phpDocumentor 1.4.3