19 private const SUPPORTED_NOTIFICATION_TYPES = [
'translate-mgs-message-added' ];
21 public static function registerHooks( array &$hooks ):
void {
22 $hooks[
'BeforeCreateEchoEvent'][] =
static function (
23 array &$notifications,
24 array &$notificationCategories,
25 array &$notificationIcons
27 Services::getInstance()->getMessageGroupSubscriptionHookHandler()->onBeforeCreateEchoEvent(
29 $notificationCategories,
34 $hooks[
'EchoGetBundleRules'][] =
static function ( Event $event,
string &$bundleKey ) {
35 Services::getInstance()->getMessageGroupSubscriptionHookHandler()->onEchoGetBundleRules(
42 public function onBeforeCreateEchoEvent(
43 array &$notifications,
44 array &$notificationCategories,
45 array &$notificationIcons
47 $notificationCategories[
'translate-message-group-subscription' ] = [
48 'tooltip' =>
'echo-pref-tooltip-translate-message-group-subscription'
51 $notifications[
'translate-mgs-message-added' ] = [
52 'category' =>
'translate-message-group-subscription',
54 'section' =>
'message',
55 'presentation-model' => MessageGroupSubscriptionPresentationModel::class,
62 $notificationIcons[
'translate-mgs-icon' ] = [
63 'path' =>
'Translate/resources/images/bell.svg'
69 if ( in_array( $event->getType(), self::SUPPORTED_NOTIFICATION_TYPES ) ) {
70 $bundleKey = $event->getExtraParam(
'groupId' );