Skip to content

Commit 5bde6fd

Browse files
authored
Merge pull request #6363 from WoltLab/6.2-dynamic-event-names
Add support for dynamic event names
2 parents 1c97c33 + bf39b45 commit 5bde6fd

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

com.woltlab.wcf/templates/notificationSettings.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{foreach from=$eventList item=event}
2525
<div class="notificationSettingsItem">
2626
<div class="notificationSettingsEvent">
27-
<label for="settings_{$event->eventID}">{lang}wcf.user.notification.{$event->objectType}.{$event->eventName}{/lang}</label>
27+
<label for="settings_{$event->eventID}">{unsafe:$event->getEventName()}</label>
2828
</div>
2929
<div class="notificationSettingsState">
3030
<label>

wcfsetup/install/files/acp/templates/notificationPresetSettings.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
{foreach from=$eventList item=event}
5656
<div class="notificationSettingsItem">
5757
<div class="notificationSettingsEvent">
58-
<label for="settings_{$event->eventID}">{lang}wcf.user.notification.{$event->objectType}.{$event->eventName}{/lang}</label>
58+
<label for="settings_{$event->eventID}">{unsafe:$event->getEventName()}</label>
5959
</div>
6060
<div class="notificationSettingsState">
6161
<label>

wcfsetup/install/files/lib/system/user/notification/event/AbstractUserNotificationEvent.class.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,4 +356,10 @@ public function getUsername()
356356
{
357357
return $this->getAuthor()->username;
358358
}
359+
360+
#[\Override]
361+
public function getEventName(): string
362+
{
363+
return WCF::getLanguage()->getDynamicVariable("wcf.user.notification.{$this->objectType}.{$this->eventName}");
364+
}
359365
}

wcfsetup/install/files/lib/system/user/notification/event/IUserNotificationEvent.class.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,12 @@ public function getNotification();
190190
* @return IUserNotificationObject
191191
*/
192192
public function getUserNotificationObject();
193+
194+
/**
195+
* Returns the generic name of this event.
196+
* The name is displayed to the user in the notification settings.
197+
*
198+
* @since 6.2
199+
*/
200+
public function getEventName(): string;
193201
}

0 commit comments

Comments
 (0)