silverstripe-framework/Forms/SelectionGroup_Item.php
Damian Mooyman 8dd644d25d
API Namespace all classes
Namespace all templates
Move difflib and BBCodeParser2 to thirdparty
Remove deprecated API marked for removal in 4.0
2016-09-08 10:23:17 +12:00

58 lines
856 B
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)
{
$this->value = $Value;
return $this;
}
}