silverstripe-framework/src/Forms/TimeField_Readonly.php

27 lines
578 B
PHP
Raw Normal View History

<?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-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-11-29 00:31:16 +01:00
return "<span class=\"readonly\" id=\"" . $this->ID() . "\">$val</span>";
}
}