silverstripe-framework/src/Forms/SelectionGroup_Item.php
Damian Mooyman 029a8b9586
API Substitute Zend_Currency with NumberFormatter based solution
API Substitute Zend_Locale with Locale / NumberFormatter
API Substitute Zend_Date with IntlDateFormatter
API Added DBTIme::Nice12, FormatFromSettings
API Added Short() method to DBDate / DBTime / DBDatetime
API Add Date::getTimestamp()
API Added setSubmittedValue api for FormField
API Add second arg to base FormField::setValue()
API Major refactor of i18n into component data parts
API Implement Resettable interface to reset objects between tests
ENHANCEMENT Changed DBField::create_field return type to `static` to support better type hinting
ENHANCEMENT i18nTextCollector supports __CLASS__
2017-02-09 15:28:59 +13:00

57 lines
1.0 KiB
PHP

<?php
namespace SilverStripe\Forms;
class SelectionGroup_Item extends CompositeField
{
/**
* @var String
*/
protected $value;
/**
* @var String
*/
protected $title;
/**
* @param String $value Form field identifier
* @param FormField|array $fields Contents of the option
* @param String $title Title to show for the radio button option
*/
function __construct($value, $fields = null, $title = null)
{
$this->setValue($value);
if ($fields && !is_array($fields)) {
$fields = array($fields);
}
parent::__construct($fields);
$this->setTitle($title ?: $value);
}
function getTitle()
{
return $this->title;
}
function setTitle($title)
{
$this->title = $title;
return $this;
}
function getValue()
{
return $this->value;
}
function setValue($Value, $data = null)
{
$this->value = $Value;
return $this;
}
}