[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_newsfeeds/src/Extension/ -> NewsfeedsComponent.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_newsfeeds
   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\Newsfeeds\Administrator\Extension;
  12  
  13  use Joomla\CMS\Association\AssociationServiceInterface;
  14  use Joomla\CMS\Association\AssociationServiceTrait;
  15  use Joomla\CMS\Categories\CategoryServiceInterface;
  16  use Joomla\CMS\Categories\CategoryServiceTrait;
  17  use Joomla\CMS\Component\Router\RouterServiceInterface;
  18  use Joomla\CMS\Component\Router\RouterServiceTrait;
  19  use Joomla\CMS\Extension\BootableExtensionInterface;
  20  use Joomla\CMS\Extension\MVCComponent;
  21  use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
  22  use Joomla\CMS\Tag\TagServiceInterface;
  23  use Joomla\CMS\Tag\TagServiceTrait;
  24  use Joomla\Component\Newsfeeds\Administrator\Service\HTML\AdministratorService;
  25  use Psr\Container\ContainerInterface;
  26  
  27  // phpcs:disable PSR1.Files.SideEffects
  28  \defined('JPATH_PLATFORM') or die;
  29  // phpcs:enable PSR1.Files.SideEffects
  30  
  31  /**
  32   * Component class for com_newsfeeds
  33   *
  34   * @since  4.0.0
  35   */
  36  class NewsfeedsComponent extends MVCComponent implements
  37      BootableExtensionInterface,
  38      CategoryServiceInterface,
  39      AssociationServiceInterface,
  40      RouterServiceInterface,
  41      TagServiceInterface
  42  {
  43      use AssociationServiceTrait;
  44      use HTMLRegistryAwareTrait;
  45      use RouterServiceTrait;
  46      use CategoryServiceTrait, TagServiceTrait {
  47          CategoryServiceTrait::getTableNameForSection insteadof TagServiceTrait;
  48          CategoryServiceTrait::getStateColumnForSection insteadof TagServiceTrait;
  49      }
  50  
  51      /**
  52       * Booting the extension. This is the function to set up the environment of the extension like
  53       * registering new class loaders, etc.
  54       *
  55       * If required, some initial set up can be done from services of the container, eg.
  56       * registering HTML services.
  57       *
  58       * @param   ContainerInterface  $container  The container
  59       *
  60       * @return  void
  61       *
  62       * @since   4.0.0
  63       */
  64      public function boot(ContainerInterface $container)
  65      {
  66          $this->getRegistry()->register('newsfeedsadministrator', new AdministratorService());
  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 $section === 'category' ? 'categories' : 'newsfeeds';
  81      }
  82  
  83      /**
  84       * Returns the state column for the count items functions for the given section.
  85       *
  86       * @param   string  $section  The section
  87       *
  88       * @return  string|null
  89       *
  90       * @since   4.0.0
  91       */
  92      protected function getStateColumnForSection(string $section = null)
  93      {
  94          return 'published';
  95      }
  96  }


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