Source for file list.php
Documentation is available at list.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* Form Field class for the Joomla Platform.
* Supports a generic list of options.
* @package Joomla.Platform
protected $type =
'List';
* Method to get the field input markup for a generic list.
* Use the multiple attribute to enable multiselect.
* @return string The field input markup.
// Initialize some field attributes.
$attr .=
!empty($this->class) ?
' class="' .
$this->class .
'"' :
'';
$attr .=
!empty($this->size) ?
' size="' .
$this->size .
'"' :
'';
$attr .=
$this->multiple ?
' multiple' :
'';
$attr .=
$this->required ?
' required aria-required="true"' :
'';
$attr .=
$this->autofocus ?
' autofocus' :
'';
// To avoid user's confusion, readonly="true" should imply disabled="true".
$attr .=
' disabled="disabled"';
// Initialize JavaScript field attributes.
// Get the field options.
// Create a read-only list (no name) with a hidden input to store the value.
$html[] =
JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);
$html[] =
'<input type="hidden" name="' .
$this->name .
'" value="' .
$this->value .
'"/>';
// Create a regular list.
$html[] =
JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
* Method to get the field options.
* @return array The field option objects.
foreach ($this->element->children() as $option)
// Only add <option /> elements.
if ($option->getName() !=
'option')
if ($requires =
explode(',', (string)
$option['requires']))
// Requires multilanguage
$value = (string)
$option['value'];
$disabled = (string)
$option['disabled'];
$disabled =
($disabled ==
'true' ||
$disabled ==
'disabled' ||
$disabled ==
'1');
$disabled =
$disabled ||
($this->readonly &&
$value !=
$this->value);
// Create a new option object based on the <option /> element.
// 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.
Documentation generated on Tue, 19 Nov 2013 15:07:15 +0100 by phpDocumentor 1.4.3