[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/system/stats/src/Field/ -> DataField.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Plugin
   5   * @subpackage  System.stats
   6   *
   7   * @copyright   (C) 2016 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\Plugin\System\Stats\Field;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Plugin\PluginHelper;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('_JEXEC') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Unique ID Field class for the Stats Plugin.
  22   *
  23   * @since  3.5
  24   */
  25  class DataField extends AbstractStatsField
  26  {
  27      /**
  28       * The form field type.
  29       *
  30       * @var    string
  31       * @since  3.5
  32       */
  33      protected $type = 'Data';
  34  
  35      /**
  36       * Name of the layout being used to render the field
  37       *
  38       * @var    string
  39       * @since  3.5
  40       */
  41      protected $layout = 'field.data';
  42  
  43      /**
  44       * Method to get the data to be passed to the layout for rendering.
  45       *
  46       * @return  array
  47       *
  48       * @since   3.5
  49       */
  50      protected function getLayoutData()
  51      {
  52          $data       = parent::getLayoutData();
  53  
  54          PluginHelper::importPlugin('system', 'stats');
  55  
  56          $result = Factory::getApplication()->triggerEvent('onGetStatsData', array('stats.field.data'));
  57  
  58          $data['statsData'] = $result ? reset($result) : array();
  59  
  60          return $data;
  61      }
  62  }


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