CoreFiles by mySites.guru
usergrouplist.php71 lines, 1,410 bytes, from Joomla_3.6.4-Stable-Full_Package.zip
Raw History Compare with 3.6.3
md5
cab37f60fc5af88e4c090e7ef33491e2
sha1
1a9d2e37139fa4051156bb0a22b277c809ce1173
sha256
80c84a6ac79b0fc2465dbb734608d05aa4083c580dcda81bfcb442062cb9ebbf
<?php
/**
 * @package     Joomla.Libraries
 * @subpackage  Form
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Field to load a dropdown list of available user groups
 *
 * @since  3.2
 */
class JFormFieldUserGroupList extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since   3.2
	 */
	protected $type = 'UserGroupList';

	/**
	 * 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()
	{
		// Hash for caching
		$hash = md5($this->element);

		if (!isset(static::$options[$hash]))
		{
			static::$options[$hash] = parent::getOptions();

			$groups = JHelperUsergroups::getInstance()->getAll();

			$options = array();

			foreach ($groups as $group)
			{
				$options[] = (object) array(
					'text'  => str_repeat('- ', $group->level) . $group->title,
					'value' => $group->id,
					'level' => $group->level
				);
			}

			static::$options[$hash] = array_merge(static::$options[$hash], $options);
		}

		return static::$options[$hash];
	}
}

The same content is in 5 releases, Joomla 3.6.3-rc1 to 3.6.4. See them all, or every version of this file.