2016-08-19 00:51:35 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms;
|
|
|
|
|
|
|
|
use SilverStripe\Core\Convert;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The readonly class for our {@link TimeField}.
|
|
|
|
*/
|
|
|
|
class TimeField_Readonly extends TimeField
|
|
|
|
{
|
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
protected $readonly = true;
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
public function Field($properties = array())
|
|
|
|
{
|
|
|
|
if ($this->valueObj) {
|
|
|
|
$val = Convert::raw2xml($this->valueObj->toString($this->getConfig('timeformat')));
|
|
|
|
} else {
|
|
|
|
// TODO Localization
|
|
|
|
$val = '<i>(not set)</i>';
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
return "<span class=\"readonly\" id=\"" . $this->ID() . "\">$val</span>";
|
|
|
|
}
|
2016-08-19 00:51:35 +02:00
|
|
|
}
|