[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/quickicon/joomlaupdate/services/ -> provider.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Quickicon.Joomlaupdate
   6   *
   7   * @copyright   (C) 2019 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\Extension\PluginInterface;
  14  use Joomla\CMS\Factory;
  15  use Joomla\DI\Container;
  16  use Joomla\DI\ServiceProviderInterface;
  17  use Joomla\Event\DispatcherInterface;
  18  use Joomla\Plugin\Quickicon\Joomlaupdate\Extension\Joomlaupdate;
  19  
  20  return new class implements ServiceProviderInterface
  21  {
  22      /**
  23       * Registers the service provider with a DI container.
  24       *
  25       * @param   Container  $container  The DI container.
  26       *
  27       * @return  void
  28       *
  29       * @since   4.0.0
  30       */
  31      public function register(Container $container)
  32      {
  33          $container->set(
  34              PluginInterface::class,
  35              function (Container $container) {
  36                  // @Todo This needs to be changed to a proper factory
  37                  $plugin = \Joomla\CMS\Plugin\PluginHelper::getPlugin('quickicon', 'joomlaupdate');
  38  
  39                  $plugin = new Joomlaupdate(
  40                      $container->get(DispatcherInterface::class),
  41                      Factory::getApplication()->getDocument(),
  42                      (array) $plugin
  43                  );
  44                  $plugin->setApplication(Factory::getApplication());
  45  
  46                  return $plugin;
  47              }
  48          );
  49      }
  50  };


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