- md5
- 0de8d02ce237007101c230e9298e671a
- sha1
- 918c2540baac9e4a844e113cad6cf61961c33a46
- sha256
- 35d093928a8c3604df7e0320bb996b9ca40debb8c9158db9b302f8e353ee6610
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Form\Field;
\defined('JPATH_PLATFORM') or die;
use Joomla\CMS\Factory;
/**
* Form Field to load a list of content authors
*
* @since 3.2
*/
class AuthorField extends ListField
{
/**
* The form field type.
*
* @var string
* @since 3.2
*/
public $type = 'Author';
/**
* Cached array of the category items.
*
* @var array
* @since 3.2
*/
protected static $options = array();
/**
* Method to get the options to populate list
*
* @return array The field option objects.
*
* @since 3.2
*/
protected function getOptions()
{
// Accepted modifiers
$hash = md5($this->element);
if (!isset(static::$options[$hash]))
{
static::$options[$hash] = parent::getOptions();
$db = Factory::getDbo();
// Construct the query
$query = $db->getQuery(true)
->select(
[
$db->quoteName('u.id', 'value'),
$db->quoteName('u.name', 'text'),
]
)
->from($db->quoteName('#__users', 'u'))
->join('INNER', $db->quoteName('#__content', 'c'), $db->quoteName('c.created_by') . ' = ' . $db->quoteName('u.id'))
->group(
[
$db->quoteName('u.id'),
$db->quoteName('u.name'),
]
)
->order($db->quoteName('u.name'));
// Setup the query
$db->setQuery($query);
// Return the result
if ($options = $db->loadObjectList())
{
static::$options[$hash] = array_merge(static::$options[$hash], $options);
}
}
return static::$options[$hash];
}
}
The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.