EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/102750
Change subject: Allow icon paths to be resolved when requested
......................................................................
Allow icon paths to be resolved when requested
Some information icons need, like output text direction
(ltr/rtl) needs cannot be resolved at the same time
$wgEchoNotificationIcons is being populated. To allow
for this accept 0 parameter closures which resolve into
the icon's path.
Change-Id: I0e2bad6377722e0024e3d7c35db6f012b45e3dd5
---
M formatters/BasicFormatter.php
M includes/EmailFormatter.php
2 files changed, 12 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/50/102750/1
diff --git a/formatters/BasicFormatter.php b/formatters/BasicFormatter.php
index 8d3bce3..4089914 100644
--- a/formatters/BasicFormatter.php
+++ b/formatters/BasicFormatter.php
@@ -185,6 +185,12 @@
}
$iconInfo = $wgEchoNotificationIcons[$this->icon];
+ // Information like rtl/ltr isn't always available early
+ // in the request cycle. Allow it to be resolved later.
+ // See Bug 58705
+ if ( $iconInfo instanceof Closure ) {
+ $iconInfo = $iconInfo();
+ }
if ( isset( $iconInfo['url'] ) && $iconInfo['url'] ) {
$iconUrl = $iconInfo['url'];
} else {
diff --git a/includes/EmailFormatter.php b/includes/EmailFormatter.php
index 61b23e3..7c21299 100644
--- a/includes/EmailFormatter.php
+++ b/includes/EmailFormatter.php
@@ -172,6 +172,12 @@
global $wgEchoNotificationIcons, $wgExtensionAssetsPath;
$iconInfo = $wgEchoNotificationIcons[$icon];
+ // Information like rtl/ltr isn't always available early
+ // in the request cycle. Allow it to be resolved later.
+ // See Bug 58705
+ if ( $iconInfo instanceof Closure ) {
+ $iconInfo = $iconInfo();
+ }
if ( isset( $iconInfo['url'] ) && $iconInfo['url'] ) {
$iconUrl = $iconInfo['url'];
} else {
--
To view, visit https://gerrit.wikimedia.org/r/102750
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e2bad6377722e0024e3d7c35db6f012b45e3dd5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits