jenkins-bot has submitted this change and it was merged.
Change subject: Simplify boolean attribute handling for Html::input in templates
......................................................................
Simplify boolean attribute handling for Html::input in templates
The Html class supports this handy shorthand.
Change-Id: Ie34790fa650c7ecad02c2d91130bf0db9172ea3f
---
M includes/templates/Usercreate.php
M includes/templates/Userlogin.php
2 files changed, 9 insertions(+), 13 deletions(-)
Approvals:
Parent5446: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/templates/Usercreate.php
b/includes/templates/Usercreate.php
index 7a4b9f2..4750af9 100644
--- a/includes/templates/Usercreate.php
+++ b/includes/templates/Usercreate.php
@@ -158,9 +158,10 @@
'id' => 'wpEmail',
'tabindex' => '6',
'size' => '20',
+ 'required' =>
$this->data['emailrequired'],
'placeholder' =>
$this->getMsg( $this->data['loggedin'] ?
'createacct-another-email-ph' : 'createacct-email-ph' )->text()
- ) + (
$this->data['emailrequired'] ? array() : array( 'required' => '' ) ) );
+ ) );
?>
<?php } ?>
</div>
diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php
index f5ae353..5eb6094 100644
--- a/includes/templates/Userlogin.php
+++ b/includes/templates/Userlogin.php
@@ -69,10 +69,6 @@
</label>
<?php
$extraAttrs = array();
- // Set focus to this field if it's blank.
- if ( !$this->data['name'] ) {
- $extraAttrs['autofocus'] = '';
- }
echo Html::input( 'wpName',
$this->data['name'], 'text', array(
'class' => 'loginText',
'id' => 'wpName1',
@@ -80,9 +76,11 @@
'size' => '20',
// 'required' is blacklisted for now in
Html.php due to browser issues.
// Keeping here in case that changes.
- 'required',
+ 'required' => true,
+ // Set focus to this field if it's
blank.
+ 'autofocus' => !$this->data['name'],
'placeholder' => $this->getMsg(
'userlogin-yourname-ph' )->text()
- ) + $extraAttrs );
+ ) );
?>
</div>
@@ -101,18 +99,15 @@
?>
</label>
<?php
- $extraAttrs = array();
- // Set focus to this field if username is
filled in.
- if ( $this->data['name'] ) {
- $extraAttrs['autofocus'] = '';
- }
echo Html::input( 'wpPassword', null,
'password', array(
'class' => 'loginPassword',
'id' => 'wpPassword1',
'tabindex' => '2',
'size' => '20',
+ // Set focus to this field if username
is filled in.
+ 'autofocus' =>
(bool)$this->data['name'],
'placeholder' => $this->getMsg(
'userlogin-yourpassword-ph' )->text()
- ) + $extraAttrs );
+ ) );
?>
</div>
--
To view, visit https://gerrit.wikimedia.org/r/90155
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie34790fa650c7ecad02c2d91130bf0db9172ea3f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits