jenkins-bot has submitted this change and it was merged.
Change subject: Add optional info-message and discussion-message configs
......................................................................
Add optional info-message and discussion-message configs
These the over-ride info-link and discussion-link configs respectively
with a localisable message. Also remove the requirement for info-link
and discussion-link to be supplied, as the logic to XOR require -link
or -msg is a pain and this is triviably circumventable by setting to
false.
Bug: 54788
Change-Id: Iccf52b789682d04bd5c4539e5bbb227e0b72ebc2
---
M BetaFeaturesHooks.php
M includes/HTMLFeatureField.php
2 files changed, 23 insertions(+), 12 deletions(-)
Approvals:
MarkTraceur: Looks good to me, approved
jenkins-bot: Verified
diff --git a/BetaFeaturesHooks.php b/BetaFeaturesHooks.php
index b5020e5..7a205da 100644
--- a/BetaFeaturesHooks.php
+++ b/BetaFeaturesHooks.php
@@ -236,13 +236,12 @@
$requiredFields = array(
'label-message' => true,
'desc-message' => true,
- // The next two could probably not be required
at a
- // later date, but currently they're required
for the
- // design to work.
- 'info-link' => true,
- 'discussion-link' => true,
'screenshot' => false,
'requirements' => false,
+ 'info-link' => false,
+ 'info-message' => false,
+ 'discussion-link' => false,
+ 'discussion-message' => false,
);
foreach ( $requiredFields as $field => $required ) {
diff --git a/includes/HTMLFeatureField.php b/includes/HTMLFeatureField.php
index 3068df5..83f71fc 100644
--- a/includes/HTMLFeatureField.php
+++ b/includes/HTMLFeatureField.php
@@ -48,14 +48,26 @@
// Close -title-contain
$html .= Html::closeElement( 'div' );
- $hasInfoLink = !empty( $this->mParams['info-link'] );
- $hasDiscussionLink = !empty( $this->mParams['discussion-link']
);
+
+ if ( isset( $this->mParams['info-message'] ) ) {
+ $infoLink = $this->mParent->msg(
$this->mParams['info-message'] )->escaped();
+ }
+ else {
+ $infoLink = $this->mParams['info-link'];
+ }
+
+ if ( isset( $this->mParams['discussion-message'] ) ) {
+ $discussionLink = $this->mParent->msg(
$this->mParams['discussion-message'] )->escaped();
+ }
+ else {
+ $discussionLink = $this->mParams['discussion-link'];
+ }
$infoLinkClasses = array(
'mw-ui-feature-info-links',
);
- if ( $hasInfoLink || $hasDiscussionLink ) {
+ if ( isset( $infoLink ) || isset( $discussionLink ) ) {
$infoLinkClasses[] = 'filled';
}
@@ -63,16 +75,16 @@
'class' => $infoLinkClasses,
) );
- if ( $hasInfoLink ) {
+ if ( isset( $infoLink ) ) {
$html .= Html::rawElement( 'a', array(
- 'href' => $this->mParams['info-link'],
+ 'href' => $infoLink,
'class' => 'mw-ui-feature-info-link',
), $this->mParent->msg( 'mw-ui-feature-info'
)->escaped() );
}
- if ( $hasDiscussionLink ) {
+ if ( isset( $discussionLink ) ) {
$html .= Html::rawElement( 'a', array(
- 'href' => $this->mParams['discussion-link'],
+ 'href' => $discussionLink,
'class' => 'mw-ui-feature-discussion-link',
), $this->mParent->msg( 'mw-ui-feature-discuss'
)->escaped() );
}
--
To view, visit https://gerrit.wikimedia.org/r/92763
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iccf52b789682d04bd5c4539e5bbb227e0b72ebc2
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/BetaFeatures
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits