* @copyright 2024 Eddy Prosperi * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Categories\CategoryFactoryInterface; use Joomla\CMS\Component\Router\RouterFactoryInterface; use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface; use Joomla\CMS\Extension\ComponentInterface; use Joomla\CMS\Extension\Service\Provider\CategoryFactory; use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory; use Joomla\CMS\Extension\Service\Provider\MVCFactory; use Joomla\CMS\Extension\Service\Provider\RouterFactory; use Joomla\CMS\HTML\Registry; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Pcrt\Component\Highlights\Administrator\Extension\HighlightsComponent; use Joomla\DI\Container; use Joomla\DI\ServiceProviderInterface; /** * The Highlights service provider. * * @since 1.0.0 */ return new class implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 1.0.0 */ public function register(Container $container) { $container->registerServiceProvider(new CategoryFactory('\\Pcrt\\Component\\Highlights')); $container->registerServiceProvider(new MVCFactory('\\Pcrt\\Component\\Highlights')); $container->registerServiceProvider(new ComponentDispatcherFactory('\\Pcrt\\Component\\Highlights')); $container->registerServiceProvider(new RouterFactory('\\Pcrt\\Component\\Highlights')); $container->set( ComponentInterface::class, function (Container $container) { $component = new HighlightsComponent($container->get(ComponentDispatcherFactoryInterface::class)); $component->setRegistry($container->get(Registry::class)); $component->setMVCFactory($container->get(MVCFactoryInterface::class)); $component->setCategoryFactory($container->get(CategoryFactoryInterface::class)); $component->setRouterFactory($container->get(RouterFactoryInterface::class)); return $component; } ); } };