[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_banners/src/Extension/ -> BannersComponent.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  namespace Joomla\Component\Banners\Administrator\Extension;
  12  
  13  use Joomla\CMS\Categories\CategoryServiceInterface;
  14  use Joomla\CMS\Categories\CategoryServiceTrait;
  15  use Joomla\CMS\Component\Router\RouterServiceInterface;
  16  use Joomla\CMS\Component\Router\RouterServiceTrait;
  17  use Joomla\CMS\Extension\BootableExtensionInterface;
  18  use Joomla\CMS\Extension\MVCComponent;
  19  use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
  20  use Joomla\CMS\Tag\TagServiceInterface;
  21  use Joomla\CMS\Tag\TagServiceTrait;
  22  use Joomla\Component\Banners\Administrator\Service\Html\Banner;
  23  use Joomla\Database\DatabaseInterface;
  24  use Psr\Container\ContainerInterface;
  25  
  26  // phpcs:disable PSR1.Files.SideEffects
  27  \defined('JPATH_PLATFORM') or die;
  28  // phpcs:enable PSR1.Files.SideEffects
  29  
  30  /**
  31   * Component class for com_banners
  32   *
  33   * @since  4.0.0
  34   */
  35  class BannersComponent extends MVCComponent implements
  36      BootableExtensionInterface,
  37      CategoryServiceInterface,
  38      RouterServiceInterface,
  39      TagServiceInterface
  40  {
  41      use HTMLRegistryAwareTrait;
  42      use RouterServiceTrait;
  43      use CategoryServiceTrait, TagServiceTrait {
  44          CategoryServiceTrait::getTableNameForSection insteadof TagServiceTrait;
  45          CategoryServiceTrait::getStateColumnForSection insteadof TagServiceTrait;
  46      }
  47  
  48      /**
  49       * Booting the extension. This is the function to set up the environment of the extension like
  50       * registering new class loaders, etc.
  51       *
  52       * If required, some initial set up can be done from services of the container, eg.
  53       * registering HTML services.
  54       *
  55       * @param   ContainerInterface  $container  The container
  56       *
  57       * @return  void
  58       *
  59       * @since   4.0.0
  60       */
  61      public function boot(ContainerInterface $container)
  62      {
  63          $banner = new Banner();
  64          $banner->setDatabase($container->get(DatabaseInterface::class));
  65  
  66          $this->getRegistry()->register('banner', $banner);
  67      }
  68  
  69      /**
  70       * Returns the table for the count items functions for the given section.
  71       *
  72       * @param   string  $section  The section
  73       *
  74       * @return  string|null
  75       *
  76       * @since   4.0.0
  77       */
  78      protected function getTableNameForSection(string $section = null)
  79      {
  80          return 'banners';
  81      }
  82  }


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