Files
System-testowy/administrator/components/com_testquestions/services/provider.php
T

28 lines
1.1 KiB
PHP

<?php
defined('_JEXEC') or die;
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
use Joomla\CMS\Extension\Component;
use Joomla\CMS\Extension\ComponentInterface;
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory as ComponentDispatcherFactoryServiceProvider;
use Joomla\CMS\Extension\Service\Provider\MVCFactory as MVCFactoryServiceProvider;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
return new class implements ServiceProviderInterface
{
public function register(Container $container): void
{
$container->registerServiceProvider(new MVCFactoryServiceProvider('Komponent\\Component\\Testquestions'));
$container->registerServiceProvider(new ComponentDispatcherFactoryServiceProvider('Komponent\\Component\\Testquestions'));
$container->set(
ComponentInterface::class,
function (Container $container) {
return new Component($container->get(ComponentDispatcherFactoryInterface::class));
}
);
}
};