67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
|
|
*
|
|
* This file is part of a Moko Consulting project.
|
|
*
|
|
* SPDX-LICENSE-IDENTIFIER: GPL-3.0-or-later
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License (./LICENSE.md).
|
|
*
|
|
* FILE INFORMATION
|
|
* DEFGROUP: Joomla.Plugin
|
|
* INGROUP: MokoSuite
|
|
* REPO: https://github.com/mokoconsulting-tech/mokosuite
|
|
* VERSION: 02.34.83
|
|
* PATH: /src/services/provider.php
|
|
* BRIEF: Service provider for dependency injection in Joomla 5.x
|
|
* NOTE: Registers the plugin with Joomla's DI container
|
|
*/
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Extension\PluginInterface;
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Plugin\PluginHelper;
|
|
use Joomla\DI\Container;
|
|
use Joomla\DI\ServiceProviderInterface;
|
|
use Joomla\Event\DispatcherInterface;
|
|
use Moko\Plugin\System\MokoSuite\Extension\MokoSuite;
|
|
|
|
return new class () implements ServiceProviderInterface {
|
|
/**
|
|
* Registers the service provider with a DI container.
|
|
*
|
|
* @param Container $container The DI container.
|
|
*
|
|
* @return void
|
|
*
|
|
* @since 01.04.00
|
|
*/
|
|
public function register(Container $container)
|
|
{
|
|
$container->set(
|
|
PluginInterface::class,
|
|
function (Container $container) {
|
|
$plugin = new MokoSuite(
|
|
$container->get(DispatcherInterface::class),
|
|
(array) PluginHelper::getPlugin('system', 'mokosuite')
|
|
);
|
|
$plugin->setApplication(Factory::getApplication());
|
|
|
|
return $plugin;
|
|
}
|
|
);
|
|
}
|
|
};
|