MINOR Removed unnecessary $timeformat parameter from TimeField::__construct, and getting the default from Zend_Locale_Format in the same way that DateField behaves (unreleased API, so no api change).

MINOR Automatically choosing $locale in TimeField::__construct, to be consistent with DateField (from r103975)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112328 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-14 23:53:13 +00:00
parent 683cf79fe6
commit c969e04731

View File

@ -30,7 +30,7 @@ class TimeField extends TextField {
protected $config = array( protected $config = array(
'showdropdown' => false, 'showdropdown' => false,
'timeformat' => null, 'timeformat' => 'HH:mm:ss',
'use_strtotime' => true, 'use_strtotime' => true,
'datavalueformat' => 'HH:mm:ss' 'datavalueformat' => 'HH:mm:ss'
); );
@ -47,20 +47,13 @@ class TimeField extends TextField {
*/ */
protected $valueObj = null; protected $valueObj = null;
/** function __construct($name, $title = null, $value = ""){
* Constructor saves the format difference. Timefields shouldn't if(!$this->locale) {
* have a problem with length as times can only be represented in on way. $this->locale = i18n::get_locale();
* }
* @param $name string The name of the field
* @param $title string The Title of the field if(!$this->getConfig('timeformat')) {
* @param $value string the value for the field $this->setConfig('timeformat', Zend_Locale_Format::getDateFormat($this->locale));
* @param $timeformat string The Time format in ISO format (see Zend_Date)
*/
function __construct($name, $title = null, $value = "",$timeformat = 'HH:mm:ss'){
if($timeformat) {
$this->setConfig('timeformat', $timeformat);
} else {
$this->setConfig('timeformat', Zend_Locale_Format::getTimeFormat($this->locale));
} }
parent::__construct($name,$title,$value); parent::__construct($name,$title,$value);