Source for file radio.php
Documentation is available at radio.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.
* Provides radio button inputs
* @package Joomla.Platform
* @link http://www.w3.org/TR/html-markup/command.radio.html#command.radio
protected $type =
'Radio';
* Method to get the radio button field input markup.
* @return string The field input markup.
// Initialize some field attributes.
$class =
!empty($this->class) ?
' class="radio ' .
$this->class .
'"' :
' class="radio"';
$required =
$this->required ?
' required aria-required="true"' :
'';
$autofocus =
$this->autofocus ?
' autofocus' :
'';
$disabled =
$this->disabled ?
' disabled' :
'';
// Start the radio field output.
$html[] =
'<fieldset id="' .
$this->id .
'"' .
$class .
$required .
$autofocus .
$disabled .
' >';
// Get the field options.
// Build the radio field output.
foreach ($options as $i =>
$option)
// Initialize some option attributes.
$checked =
((string)
$option->value == (string)
$this->value) ?
' checked="checked"' :
'';
$class =
!empty($option->class) ?
' class="' .
$option->class .
'"' :
'';
$disabled =
!empty($option->disable) ||
($readonly &&
!$checked);
$disabled =
$disabled ?
' disabled' :
'';
// Initialize some JavaScript option attributes.
$onclick =
!empty($option->onclick) ?
' onclick="' .
$option->onclick .
'"' :
'';
$onchange =
!empty($option->onchange) ?
' onchange="' .
$option->onchange .
'"' :
'';
$html[] =
'<input type="radio" id="' .
$this->id .
$i .
'" name="' .
$this->name .
'" value="'
.
htmlspecialchars($option->value, ENT_COMPAT, 'UTF-8') .
'"' .
$checked .
$class .
$required .
$onclick
.
$onchange .
$disabled .
' />';
$html[] =
'<label for="' .
$this->id .
$i .
'"' .
$class .
' >'
// End the radio field output.
* Method to get the field options for radio buttons.
* @return array The field option objects.
foreach ($this->element->children() as $option)
// Only add <option /> elements.
if ($option->getName() !=
'option')
$disabled = (string)
$option['disabled'];
$disabled =
($disabled ==
'true' ||
$disabled ==
'disabled' ||
$disabled ==
'1');
// Create a new option object based on the <option /> element.
'select.option', (string)
$option['value'], trim((string)
$option), 'value', 'text',
// Set some option attributes.
$tmp->class = (string)
$option['class'];
// Set some JavaScript option attributes.
$tmp->onclick = (string)
$option['onclick'];
$tmp->onchange = (string)
$option['onchange'];
// Add the option object to the result set.
Documentation generated on Tue, 19 Nov 2013 15:11:33 +0100 by phpDocumentor 1.4.3