silverstripe-framework/Forms/TimeField_Readonly.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

27 lines
515 B
PHP

<?php
namespace SilverStripe\Forms;
use SilverStripe\Core\Convert;
/**
* The readonly class for our {@link TimeField}.
*/
class TimeField_Readonly extends TimeField
{
protected $readonly = true;
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>';
}
return "<span class=\"readonly\" id=\"" . $this->ID() . "\">$val</span>";
}
}