Skip to content

Commit 63c25c1

Browse files
committed
Change com_config to services
1 parent 47ae523 commit 63c25c1

File tree

3 files changed

+57
-43
lines changed

3 files changed

+57
-43
lines changed

administrator/components/com_config/dispatcher.php

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* @package Joomla.Administrator
4+
* @subpackage com_config
5+
*
6+
* @copyright Copyright (C) 2005 - 2018 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+
use Joomla\CMS\Dispatcher\DispatcherFactoryInterface;
13+
use Joomla\CMS\Extension\ComponentInterface;
14+
use Joomla\CMS\Extension\MVCComponent;
15+
use Joomla\CMS\Extension\Service\Provider\DispatcherFactory;
16+
use Joomla\CMS\Extension\Service\Provider\MVCFactoryFactory;
17+
use Joomla\CMS\MVC\Factory\MVCFactoryFactoryInterface;
18+
use Joomla\DI\Container;
19+
use Joomla\DI\ServiceProviderInterface;
20+
21+
/**
22+
* The config service provider.
23+
*
24+
* @since 4.0.0
25+
*/
26+
return new class implements ServiceProviderInterface
27+
{
28+
/**
29+
* Registers the service provider with a DI container.
30+
*
31+
* @param Container $container The DI container.
32+
*
33+
* @return void
34+
*
35+
* @since 4.0.0
36+
*/
37+
public function register(Container $container)
38+
{
39+
$container->registerServiceProvider(new MVCFactoryFactory('\\Joomla\\Component\\Config'));
40+
$container->registerServiceProvider(new DispatcherFactory('\\Joomla\\Component\\Config'));
41+
42+
$container->set(
43+
ComponentInterface::class,
44+
function (Container $container)
45+
{
46+
$component = new MVCComponent($container->get(DispatcherFactoryInterface::class));
47+
48+
$component->setMvcFactoryFactory($container->get(MVCFactoryFactoryInterface::class));
49+
50+
return $component;
51+
}
52+
);
53+
}
54+
};

components/com_config/dispatcher.php renamed to components/com_config/Dispatcher/Dispatcher.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,19 @@
77
* @license GNU General Public License version 2 or later; see LICENSE.txt
88
*/
99

10+
namespace Joomla\Component\Config\Site\Dispatcher;
11+
1012
defined('_JEXEC') or die;
1113

1214
use Joomla\CMS\Access\Exception\NotAllowed;
13-
use Joomla\CMS\Dispatcher\Dispatcher;
1415

1516
/**
1617
* Dispatcher class for com_config
1718
*
1819
* @since 4.0.0
1920
*/
20-
class ConfigDispatcher extends Dispatcher
21+
class Dispatcher extends \Joomla\CMS\Dispatcher\Dispatcher
2122
{
22-
/**
23-
* The extension namespace
24-
*
25-
* @var string
26-
*
27-
* @since 4.0.0
28-
*/
29-
protected $namespace = 'Joomla\\Component\\Config';
30-
3123
/**
3224
* Method to check component access permission
3325
*

0 commit comments

Comments
 (0)