[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_plugins/services/ -> provider.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_plugins
   6   *
   7   * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
  14  use Joomla\CMS\Extension\ComponentInterface;
  15  use Joomla\CMS\Extension\MVCComponent;
  16  use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
  17  use Joomla\CMS\Extension\Service\Provider\MVCFactory;
  18  use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
  19  use Joomla\DI\Container;
  20  use Joomla\DI\ServiceProviderInterface;
  21  
  22  /**
  23   * The plugin service provider.
  24   *
  25   * @since  4.0.0
  26   */
  27  return new class implements ServiceProviderInterface
  28  {
  29      /**
  30       * Registers the service provider with a DI container.
  31       *
  32       * @param   Container  $container  The DI container.
  33       *
  34       * @return  void
  35       *
  36       * @since   4.0.0
  37       */
  38      public function register(Container $container)
  39      {
  40          $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Plugins'));
  41          $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Plugins'));
  42          $container->set(
  43              ComponentInterface::class,
  44              function (Container $container) {
  45                  $component = new MVCComponent($container->get(ComponentDispatcherFactoryInterface::class));
  46                  $component->setMVCFactory($container->get(MVCFactoryInterface::class));
  47  
  48                  return $component;
  49              }
  50          );
  51      }
  52  };


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer