Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/323406

Change subject: HTMLDateTimeField: Fix 'placeholder' attribute handling
......................................................................

HTMLDateTimeField: Fix 'placeholder' attribute handling

Parent class HTMLTextField handles this specially and we have to match it.

Change-Id: Ibff3caba2a58c2bcbfb342789aae9f0939b7687f
---
M includes/htmlform/fields/HTMLDateTimeField.php
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/06/323406/1

diff --git a/includes/htmlform/fields/HTMLDateTimeField.php 
b/includes/htmlform/fields/HTMLDateTimeField.php
index 88dcd24..a0eb58f 100644
--- a/includes/htmlform/fields/HTMLDateTimeField.php
+++ b/includes/htmlform/fields/HTMLDateTimeField.php
@@ -36,17 +36,17 @@
                        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';
        }
 
        public function getAttributes( array $list ) {
                $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'] );

-- 
To view, visit https://gerrit.wikimedia.org/r/323406
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibff3caba2a58c2bcbfb342789aae9f0939b7687f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to