CoreFiles by mySites.guru
PrimaryauthprovidersField.php71 lines, 1,509 bytes, from Joomla_4.1.1-Stable-Full_Package.zip
Raw History Compare with 4.1.0
md5
a79bf7dd5390c601b0126d4dd5a146ef
sha1
74a28aa8d45acdd4a62f0eff6bb1996f5c6469c4
sha256
ad218c9d4c46a5ddfa69daa6a55cb9471f82c99de261e4a6b1653fb59dc6e9ea
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_users
 *
 * @copyright   Copyright (C) 2022 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Users\Administrator\Field;

use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Plugin\PluginHelper;

defined('_JEXEC') or die;

/**
 * Auth provider field.
 *
 * @since  3.10.7
 */
class PrimaryauthprovidersField extends ListField
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.10.7
	 */
	protected $type = 'Primaryauthproviders';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects
	 *
	 * @since   3.10.7
	 */
	protected function getOptions()
	{
		// Build the filter options.
		$options = array();

		PluginHelper::importPlugin('authentication');
		$plugins = PluginHelper::getPlugin('authentication');

		foreach ($plugins as $plugin)
		{
			$className = 'plg' . $plugin->type . $plugin->name;

			if (!class_exists($className))
			{
				continue;
			}

			if (!is_subclass_of(
				$className,
				"Joomla\CMS\Authentication\ProviderAwareAuthenticationPluginInterface"
			)
				|| !$className::isPrimaryProvider())
			{
				continue;
			}

			$options[] = (object) ['value' => $className::getProviderName(), 'text' => $className::getProviderName()];
		}

		// Merge any additional options in the XML definition.
		return array_merge(parent::getOptions(), $options);
	}
}

The same content is in 2 releases, Joomla 4.1.1 to 4.2.0-alpha1. See them all, or every version of this file.