[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_banners
   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\Categories\CategoryFactoryInterface;
  14  use Joomla\CMS\Component\Router\RouterFactoryInterface;
  15  use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
  16  use Joomla\CMS\Extension\ComponentInterface;
  17  use Joomla\CMS\Extension\Service\Provider\CategoryFactory;
  18  use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
  19  use Joomla\CMS\Extension\Service\Provider\MVCFactory;
  20  use Joomla\CMS\Extension\Service\Provider\RouterFactory;
  21  use Joomla\CMS\HTML\Registry;
  22  use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
  23  use Joomla\Component\Banners\Administrator\Extension\BannersComponent;
  24  use Joomla\DI\Container;
  25  use Joomla\DI\ServiceProviderInterface;
  26  
  27  /**
  28   * The banners service provider.
  29   *
  30   * @since  4.0.0
  31   */
  32  return new class implements ServiceProviderInterface
  33  {
  34      /**
  35       * Registers the service provider with a DI container.
  36       *
  37       * @param   Container  $container  The DI container.
  38       *
  39       * @return  void
  40       *
  41       * @since   4.0.0
  42       */
  43      public function register(Container $container)
  44      {
  45          $container->registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Banners'));
  46          $container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Banners'));
  47          $container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Banners'));
  48          $container->registerServiceProvider(new RouterFactory('\\Joomla\\Component\\Banners'));
  49  
  50          $container->set(
  51              ComponentInterface::class,
  52              function (Container $container) {
  53                  $component = new BannersComponent($container->get(ComponentDispatcherFactoryInterface::class));
  54  
  55                  $component->setRegistry($container->get(Registry::class));
  56                  $component->setMVCFactory($container->get(MVCFactoryInterface::class));
  57                  $component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
  58                  $component->setRouterFactory($container->get(RouterFactoryInterface::class));
  59  
  60                  return $component;
  61              }
  62          );
  63      }
  64  };


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