98 lines
2.3 KiB
PHP
98 lines
2.3 KiB
PHP
|
<?php
|
||
|
/**
|
||
|
* @package Joomla.Component.Builder
|
||
|
*
|
||
|
* @created 4th September 2022
|
||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||
|
*/
|
||
|
|
||
|
// No direct access to this JCB template file (EVER)
|
||
|
defined('_JCB_TEMPLATE') or die;
|
||
|
?>
|
||
|
###BOM###
|
||
|
namespace ###NAMESPACEPREFIX###\Component\###ComponentNameSpace###\Site\Service;
|
||
|
|
||
|
###SITE_ROUTER_HEADER###
|
||
|
|
||
|
// No direct access to this file
|
||
|
\defined('_JEXEC') or die;
|
||
|
|
||
|
/**
|
||
|
* Router class for the ###Component_name### Component
|
||
|
*
|
||
|
* @since 3.10
|
||
|
*/
|
||
|
class Router extends RouterView
|
||
|
{
|
||
|
/**
|
||
|
* Flag to remove IDs
|
||
|
*
|
||
|
* @var boolean
|
||
|
* @since 4.0.0
|
||
|
*/
|
||
|
protected $noIDs = false;
|
||
|
|
||
|
/**
|
||
|
* The category factory
|
||
|
*
|
||
|
* @var CategoryFactoryInterface
|
||
|
* @since 4.0.0
|
||
|
*/
|
||
|
private $categoryFactory;
|
||
|
|
||
|
/**
|
||
|
* The category cache
|
||
|
*
|
||
|
* @var array
|
||
|
* @since 4.0.0
|
||
|
*/
|
||
|
private $categoryCache = [];
|
||
|
|
||
|
/**
|
||
|
* The db
|
||
|
*
|
||
|
* @var DatabaseInterface
|
||
|
* @since 4.0.0
|
||
|
*/
|
||
|
private $db;
|
||
|
|
||
|
/**
|
||
|
* The component params
|
||
|
*
|
||
|
* @var Registry
|
||
|
* @since 4.0.0
|
||
|
*/
|
||
|
private $params;
|
||
|
|
||
|
/**
|
||
|
* ###Component### Component router constructor
|
||
|
*
|
||
|
* @param SiteApplication $app The application object
|
||
|
* @param AbstractMenu $menu The menu object to work with
|
||
|
* @param CategoryFactoryInterface $categoryFactory The category object
|
||
|
* @param DatabaseInterface $db The database object
|
||
|
*
|
||
|
* @since 4.0.0
|
||
|
*/
|
||
|
public function __construct(
|
||
|
SiteApplication $app,
|
||
|
AbstractMenu $menu,
|
||
|
CategoryFactoryInterface $categoryFactory,
|
||
|
DatabaseInterface $db)
|
||
|
{
|
||
|
$this->categoryFactory = $categoryFactory;
|
||
|
$this->db = $db;
|
||
|
$this->params = ComponentHelper::getParams('com_###component###');
|
||
|
$this->noIDs = (bool) $this->params->get('sef_ids', false);###SITE_ROUTER_CONSTRUCTOR_BEFORE_PARENT###
|
||
|
|
||
|
parent::__construct($app, $menu);###SITE_ROUTER_CONSTRUCTOR_AFTER_PARENT###
|
||
|
|
||
|
$this->attachRule(new MenuRules($this));
|
||
|
$this->attachRule(new StandardRules($this));
|
||
|
$this->attachRule(new NomenuRules($this));
|
||
|
}###SITE_ROUTER_METHODS###
|
||
|
}
|