[MediaWiki-commits] [Gerrit] Change icons to use img tags, allowing easier customization: - change (mediawiki...Echo)
jenkins-bot has submitted this change and it was merged. Change subject: Change icons to use img tags, allowing easier customization: .. Change icons to use img tags, allowing easier customization: * Icon can be defined using a path or a URL * Extensions don't need custom CSS, but add icon through BeforeCreateEchoEvent * Sites set their notification icon in LocalSettings.php or equivalent Bug: 46585 Change-Id: Ifc02b653d07de19229dfb2604305e32f3bd595fe --- M Echo.php M Hooks.php M formatters/BasicFormatter.php M modules/base/ext.echo.base.css D modules/icons/icons.css M special/SpecialNotifications.php 6 files changed, 79 insertions(+), 67 deletions(-) Approvals: Kaldari: Looks good to me, approved jenkins-bot: Verified diff --git a/Echo.php b/Echo.php index 3021a31..c6aea70 100644 --- a/Echo.php +++ b/Echo.php @@ -128,7 +128,6 @@ 'mediawiki.api', 'mediawiki.jqueryMsg', 'jquery.badge', - 'ext.echo.icons', 'mediawiki.ui', ), 'messages' = array( @@ -151,16 +150,12 @@ 'ext.echo.base', 'mediawiki.api', 'mediawiki.jqueryMsg', - 'ext.echo.icons', ), 'messages' = array( 'echo-load-more-error', 'echo-more-info', 'echo-feedback', ), - ), - 'ext.echo.icons' = $echoResourceTemplate + array( - 'styles' = 'icons/icons.css', ), ); @@ -296,6 +291,56 @@ ), ); +$echoIconPath = Echo/modules/icons; + +// Defines icons, which are 30x30 images. This is passed to BeforeCreateEchoEvent so +// extensions can define their own icons with the same structure. It is recommended that +// extensions prefix their icon key. An example is myextension-name. This will help +// avoid namespace conflicts. +// +// You can use either a path or a url, but not both. +// The value of 'path' is relative to $wgExtensionAssetsPath. +// +// The value of 'url' should be a URL. +// +// You should customize the site icon URL, which is: +// $wgEchoNotificationIcons['site']['url'] +$wgEchoNotificationIcons = array( + 'placeholder' = array( + 'path' = $echoIconPath/Generic.png, + ), + 'trash' = array( + 'path' = $echoIconPath/Deletion.png, + ), + 'chat' = array( + 'path' = $echoIconPath/Talk.png, + ), + 'linked' = array( + 'path' = $echoIconPath/CrossReferenced.png, + ), + 'featured' = array( + 'path' = $echoIconPath/Featured.png, + ), + 'reviewed' = array( + 'path' = $echoIconPath/Reviewed.png, + ), + 'tagged' = array( + 'path' = $echoIconPath/ReviewedWithTags.png, + ), + 'revert' = array( + 'path' = $echoIconPath/Revert.png, + ), + 'checkmark' = array( + 'path' = $echoIconPath/Reviewed.png, + ), + 'gratitude' = array( + 'path' = $echoIconPath/Gratitude.png, + ), + 'site' = array( + 'url' = false + ), +); + // Definitions of the notification event types built into Echo. // If formatter-class isn't specified, defaults to EchoBasicFormatter. $wgEchoNotifications = array( @@ -304,6 +349,7 @@ 'group' = 'system', 'title-message' = 'notification-new-user', 'title-params' = array( 'agent' ), + 'icon' = 'site', ), 'edit-user-talk' = array( 'category' = 'edit-user-talk', @@ -399,6 +445,7 @@ 'email-body-params' = array( 'agent', 'user-rights-list', 'email-footer' ), 'email-body-batch-message' = 'notification-user-rights-email-batch-body', 'email-body-batch-params' = array( 'agent', 'user-rights-list' ), + 'icon' = 'site', ), ); diff --git a/Hooks.php b/Hooks.php index 8858fdc..44d36f4 100644 --- a/Hooks.php +++ b/Hooks.php @@ -12,10 +12,10 @@ */ public static function initEchoExtension() { global $wgEchoBackend, $wgEchoBackendName, $wgEchoNotifications, - $wgEchoNotificationCategories, $wgEchoConfig; + $wgEchoNotificationCategories, $wgEchoNotificationIcons, $wgEchoConfig; // allow extensions to define their own event - wfRunHooks( 'BeforeCreateEchoEvent', array( $wgEchoNotifications, $wgEchoNotificationCategories ) ); + wfRunHooks( 'BeforeCreateEchoEvent', array( $wgEchoNotifications, $wgEchoNotificationCategories, $wgEchoNotificationIcons ) ); $wgEchoBackend = MWEchoBackend::factory(
[MediaWiki-commits] [Gerrit] Change icons to use img tags, allowing easier customization: - change (mediawiki...Echo)
Mattflaschen has uploaded a new change for review. https://gerrit.wikimedia.org/r/61341 Change subject: Change icons to use img tags, allowing easier customization: .. Change icons to use img tags, allowing easier customization: * Icon can be defined using a path or a full URL * Extensions don't need custom CSS, but add icon through BeforeCreateEchoEvent * Sites set their notification icon in LocalSettings.php or equivalent Bug: 46585 Change-Id: Ifc02b653d07de19229dfb2604305e32f3bd595fe --- M Echo.php M Hooks.php M formatters/BasicFormatter.php M modules/base/ext.echo.base.css D modules/icons/icons.css M special/SpecialNotifications.php 6 files changed, 80 insertions(+), 67 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo refs/changes/41/61341/1 diff --git a/Echo.php b/Echo.php index 3021a31..ffac482 100644 --- a/Echo.php +++ b/Echo.php @@ -128,7 +128,6 @@ 'mediawiki.api', 'mediawiki.jqueryMsg', 'jquery.badge', - 'ext.echo.icons', 'mediawiki.ui', ), 'messages' = array( @@ -151,16 +150,12 @@ 'ext.echo.base', 'mediawiki.api', 'mediawiki.jqueryMsg', - 'ext.echo.icons', ), 'messages' = array( 'echo-load-more-error', 'echo-more-info', 'echo-feedback', ), - ), - 'ext.echo.icons' = $echoResourceTemplate + array( - 'styles' = 'icons/icons.css', ), ); @@ -296,6 +291,59 @@ ), ); +$echoIconPath = Echo/modules/icons; + +// Defines icons, which are 30x30 images. This is passed to BeforeCreateEchoEvent so +// extensions can define their own icons with the same structure. It is recommended that +// extensions prefix their icon key. An example is myextension-name. This will help +// avoid namespace conflicts. +// +// You can use either a path or a url, but not both. +// The value of 'path' is relative to $wgExtensionAssetsPath. +// +// The value of 'url' should be a URL. +// +// You must customize the site icon URL, which is: +// $wgEchoNotificationIcons['site']['url'] +$wgEchoNotificationIcons = array( + 'placeholder' = array( + 'path' = $echoIconPath/Generic.png, + ), + 'trash' = array( + 'path' = $echoIconPath/Deletion.png, + ), + 'chat' = array( + 'path' = $echoIconPath/Talk.png, + ), + 'linked' = array( + 'path' = $echoIconPath/CrossReferenced.png, + ), + 'featured' = array( + 'path' = $echoIconPath/Featured.png, + ), + 'reviewed' = array( + 'path' = $echoIconPath/Reviewed.png, + ), + 'tagged' = array( + 'path' = $echoIconPath/ReviewedWithTags.png, + ), + 'revert' = array( + 'path' = $echoIconPath/Revert.png, + ), + 'checkmark' = array( + 'path' = $echoIconPath/Reviewed.png, + ), + 'gratitude' = array( + 'path' = $echoIconPath/Gratitude.png, + ), + 'site' = array( + 'url' = false + ), +); + +// Must be customized to a URL for a 30x30 icon for the site. +$wgEchoNotificationSiteIconUrl = false; + // Definitions of the notification event types built into Echo. // If formatter-class isn't specified, defaults to EchoBasicFormatter. $wgEchoNotifications = array( @@ -304,6 +352,7 @@ 'group' = 'system', 'title-message' = 'notification-new-user', 'title-params' = array( 'agent' ), + 'icon' = 'site', ), 'edit-user-talk' = array( 'category' = 'edit-user-talk', @@ -399,6 +448,7 @@ 'email-body-params' = array( 'agent', 'user-rights-list', 'email-footer' ), 'email-body-batch-message' = 'notification-user-rights-email-batch-body', 'email-body-batch-params' = array( 'agent', 'user-rights-list' ), + 'icon' = 'site', ), ); diff --git a/Hooks.php b/Hooks.php index 8858fdc..44d36f4 100644 --- a/Hooks.php +++ b/Hooks.php @@ -12,10 +12,10 @@ */ public static function initEchoExtension() { global $wgEchoBackend, $wgEchoBackendName, $wgEchoNotifications, - $wgEchoNotificationCategories, $wgEchoConfig; + $wgEchoNotificationCategories, $wgEchoNotificationIcons, $wgEchoConfig; // allow extensions to define their own event - wfRunHooks( 'BeforeCreateEchoEvent', array( $wgEchoNotifications, $wgEchoNotificationCategories ) ); + wfRunHooks(