Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions libraries/src/Router/SiteRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,35 @@ public function getComponentRouter($component)
$this->componentRouters[$component] = $componentInstance->createRouter($this->app, $this->menu);
}

// Keep support for components implementing the new format but don't implement the RouterServiceInterface
if (!isset($this->componentRouters[$component]))
{
$compname = ucfirst(substr($component, 4));
$class = $compname . 'Router';

if (!class_exists($class))
{
// Use the component routing handler if it exists
$path = JPATH_SITE . '/components/' . $component . '/router.php';

// Use the custom routing handler if it exists
if (file_exists($path))
{
require_once $path;
}
}

if (class_exists($class))
{
$reflection = new \ReflectionClass($class);

if (in_array('Joomla\\CMS\\Component\\Router\\RouterInterface', $reflection->getInterfaceNames()))
{
$this->componentRouters[$component] = new $class($this->app, $this->menu);
}
}
}

if (!isset($this->componentRouters[$component]))
{
$this->componentRouters[$component] = new RouterLegacy(ucfirst(substr($component, 4)));
Expand Down