- md5
- 0ef296e00d5dba88c3d530c713e96b75
- sha1
- 5a148142212f4552afd41dc306ffefdb460ccc6c
- sha256
- 0198981a68ce6a9ebf6714ac80691686c30f2579871a746796fb35f327a3c52e
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
<?php
/**
* Joomla! Content Management System
*
* @copyright Copyright (C) 2005 - 2018 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;
use Joomla\CMS\Form\FormField;
/**
* Form Field class for the Joomla Platform.
* Supports a nested checkbox field listing user groups.
* Multiselect is available by default.
*
* @since 11.1
* @deprecated 3.5
*/
class UsergroupField extends FormField
{
/**
* The form field type.
*
* @var string
* @since 11.1
*/
protected $type = 'Usergroup';
/**
* Method to get the user group field input markup.
*
* @return string The field input markup.
*
* @since 11.1
*/
protected function getInput()
{
\JLog::add('JFormFieldUsergroup is deprecated. Use JFormFieldUserGroupList instead.', \JLog::WARNING, 'deprecated');
$options = array();
$attr = '';
// Initialize some field attributes.
$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
$attr .= $this->disabled ? ' disabled' : '';
$attr .= $this->size ? ' size="' . $this->size . '"' : '';
$attr .= $this->multiple ? ' multiple' : '';
$attr .= $this->required ? ' required aria-required="true"' : '';
$attr .= $this->autofocus ? ' autofocus' : '';
// Initialize JavaScript field attributes.
$attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
$attr .= !empty($this->onclick) ? ' onclick="' . $this->onclick . '"' : '';
// Iterate through the children and build an array of options.
foreach ($this->element->children() as $option)
{
// Only add <option /> elements.
if ($option->getName() != 'option')
{
continue;
}
$disabled = (string) $option['disabled'];
$disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');
// Create a new option object based on the <option /> element.
$tmp = \JHtml::_(
'select.option', (string) $option['value'], trim((string) $option), 'value', 'text',
$disabled
);
// Set some option attributes.
$tmp->class = (string) $option['class'];
// Set some JavaScript option attributes.
$tmp->onclick = (string) $option['onclick'];
// Add the option object to the result set.
$options[] = $tmp;
}
return \JHtml::_('access.usergroup', $this->name, $this->value, $attr, $options, $this->id);
}
}
No other release has this exact content. See every version of this file.