[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/content/finder/ -> finder.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  Content.finder
   6   *
   7   * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9  
  10   * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
  11   */
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Plugin\CMSPlugin;
  15  use Joomla\CMS\Plugin\PluginHelper;
  16  
  17  // phpcs:disable PSR1.Files.SideEffects
  18  \defined('_JEXEC') or die;
  19  // phpcs:enable PSR1.Files.SideEffects
  20  
  21  /**
  22   * Smart Search Content Plugin
  23   *
  24   * @since  2.5
  25   */
  26  class PlgContentFinder extends CMSPlugin
  27  {
  28      /**
  29       * Smart Search after save content method.
  30       * Content is passed by reference, but after the save, so no changes will be saved.
  31       * Method is called right after the content is saved.
  32       *
  33       * @param   string  $context  The context of the content passed to the plugin (added in 1.6)
  34       * @param   object  $article  A JTableContent object
  35       * @param   bool    $isNew    If the content has just been created
  36       *
  37       * @return  void
  38       *
  39       * @since   2.5
  40       */
  41      public function onContentAfterSave($context, $article, $isNew): void
  42      {
  43          PluginHelper::importPlugin('finder');
  44  
  45          // Trigger the onFinderAfterSave event.
  46          Factory::getApplication()->triggerEvent('onFinderAfterSave', array($context, $article, $isNew));
  47      }
  48  
  49      /**
  50       * Smart Search before save content method.
  51       * Content is passed by reference. Method is called before the content is saved.
  52       *
  53       * @param   string  $context  The context of the content passed to the plugin (added in 1.6).
  54       * @param   object  $article  A JTableContent object.
  55       * @param   bool    $isNew    If the content is just about to be created.
  56       *
  57       * @return  void
  58       *
  59       * @since   2.5
  60       */
  61      public function onContentBeforeSave($context, $article, $isNew)
  62      {
  63          PluginHelper::importPlugin('finder');
  64  
  65          // Trigger the onFinderBeforeSave event.
  66          Factory::getApplication()->triggerEvent('onFinderBeforeSave', array($context, $article, $isNew));
  67      }
  68  
  69      /**
  70       * Smart Search after delete content method.
  71       * Content is passed by reference, but after the deletion.
  72       *
  73       * @param   string  $context  The context of the content passed to the plugin (added in 1.6).
  74       * @param   object  $article  A JTableContent object.
  75       *
  76       * @return  void
  77       *
  78       * @since   2.5
  79       */
  80      public function onContentAfterDelete($context, $article): void
  81      {
  82          PluginHelper::importPlugin('finder');
  83  
  84          // Trigger the onFinderAfterDelete event.
  85          Factory::getApplication()->triggerEvent('onFinderAfterDelete', array($context, $article));
  86      }
  87  
  88      /**
  89       * Smart Search content state change method.
  90       * Method to update the link information for items that have been changed
  91       * from outside the edit screen. This is fired when the item is published,
  92       * unpublished, archived, or unarchived from the list view.
  93       *
  94       * @param   string   $context  The context for the content passed to the plugin.
  95       * @param   array    $pks      A list of primary key ids of the content that has changed state.
  96       * @param   integer  $value    The value of the state that the content has been changed to.
  97       *
  98       * @return  void
  99       *
 100       * @since   2.5
 101       */
 102      public function onContentChangeState($context, $pks, $value)
 103      {
 104          PluginHelper::importPlugin('finder');
 105  
 106          // Trigger the onFinderChangeState event.
 107          Factory::getApplication()->triggerEvent('onFinderChangeState', array($context, $pks, $value));
 108      }
 109  
 110      /**
 111       * Smart Search change category state content method.
 112       * Method is called when the state of the category to which the
 113       * content item belongs is changed.
 114       *
 115       * @param   string   $extension  The extension whose category has been updated.
 116       * @param   array    $pks        A list of primary key ids of the content that has changed state.
 117       * @param   integer  $value      The value of the state that the content has been changed to.
 118       *
 119       * @return  void
 120       *
 121       * @since   2.5
 122       */
 123      public function onCategoryChangeState($extension, $pks, $value)
 124      {
 125          PluginHelper::importPlugin('finder');
 126  
 127          // Trigger the onFinderCategoryChangeState event.
 128          Factory::getApplication()->triggerEvent('onFinderCategoryChangeState', array($extension, $pks, $value));
 129      }
 130  }


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