From: Bartosz DziewoƄski Date: Thu, 24 Nov 2016 15:13:40 +0000 (+0100) Subject: HTMLDateTimeField: Fix 'placeholder' attribute handling X-Git-Tag: 1.31.0-rc.0~4522^2~2 X-Git-Url: http://git.heureux-cyclage.org/?a=commitdiff_plain;h=ce247df6b516eb68b11ba55243188c641f826bbf;p=lhc%2Fweb%2Fwiklou.git HTMLDateTimeField: Fix 'placeholder' attribute handling Parent class HTMLTextField handles this specially and we have to match it. Change-Id: Ibff3caba2a58c2bcbfb342789aae9f0939b7687f --- diff --git a/includes/htmlform/fields/HTMLDateTimeField.php b/includes/htmlform/fields/HTMLDateTimeField.php index 88dcd2457b..a0eb58fcaa 100644 --- a/includes/htmlform/fields/HTMLDateTimeField.php +++ b/includes/htmlform/fields/HTMLDateTimeField.php @@ -36,6 +36,11 @@ class HTMLDateTimeField extends HTMLTextField { throw new InvalidArgumentException( "Invalid type '$this->mType'" ); } + if ( $this->mPlaceholder === '' ) { + // Messages: htmlform-date-placeholder htmlform-time-placeholder htmlform-datetime-placeholder + $this->mPlaceholder = $this->msg( "htmlform-{$this->mType}-placeholder" )->text(); + } + $this->mClass .= ' mw-htmlform-datetime-field'; } @@ -43,11 +48,6 @@ class HTMLDateTimeField extends HTMLTextField { $parentList = array_diff( $list, [ 'min', 'max' ] ); $ret = parent::getAttributes( $parentList ); - if ( in_array( 'placeholder', $list ) && !isset( $ret['placeholder'] ) ) { - // Messages: htmlform-date-placeholder htmlform-time-placeholder htmlform-datetime-placeholder - $ret['placeholder'] = $this->msg( "htmlform-{$this->mType}-placeholder" )->text(); - } - if ( in_array( 'min', $list ) && isset( $this->mParams['min'] ) ) { $min = $this->parseDate( $this->mParams['min'] ); if ( $min ) {