CoreFiles by mySites.guru
DataField.php58 lines, 1,234 bytes, from Joomla_4.2.1-rc2-Release_Candidate-Full_Package.zip
Raw History Compare with 4.2.1-rc1
md5
e06d028476e69f9dfd7315f85a5c7ca4
sha1
0afaffb3db0c0d25d998f2218cf44e96f32b315b
sha256
4eb87e8f15904ce4606daa96b3127bf600830d65371df0c53f74038097fe15ad
<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  System.stats
 *
 * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Plugin\System\Stats\Field;

use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;

/**
 * Unique ID Field class for the Stats Plugin.
 *
 * @since  3.5
 */
class DataField extends AbstractStatsField
{
    /**
     * The form field type.
     *
     * @var    string
     * @since  3.5
     */
    protected $type = 'Data';

    /**
     * Name of the layout being used to render the field
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'field.data';

    /**
     * Method to get the data to be passed to the layout for rendering.
     *
     * @return  array
     *
     * @since   3.5
     */
    protected function getLayoutData()
    {
        $data       = parent::getLayoutData();

        PluginHelper::importPlugin('system', 'stats');

        $result = Factory::getApplication()->triggerEvent('onGetStatsData', array('stats.field.data'));

        $data['statsData'] = $result ? reset($result) : array();

        return $data;
    }
}

The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.