From 71215115ebb1e06b461dc5b0fa7ee4c27d8c665c Mon Sep 17 00:00:00 2001 From: Benjamin Lorteau Date: Fri, 7 Sep 2018 11:15:23 -0400 Subject: [PATCH] Restore template choice by notification label --- mod/notifications.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mod/notifications.php b/mod/notifications.php index 212736305f..acd49de063 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -274,9 +274,19 @@ function notifications_content(App $a) // Loop trough ever notification This creates an array with the output html for each // notification and apply the correct template according to the notificationtype (label). foreach ($notifs['notifications'] as $notif) { - // We use the notification label to get the correct template file - $tpl_var_name = 'tpl_item_' . $notif['label']; - $tpl_notif = get_markup_template($$tpl_var_name); + $notification_templates = [ + 'like' => 'notifications_likes_item.tpl', + 'dislike' => 'notifications_dislikes_item.tpl', + 'attend' => 'notifications_attend_item.tpl', + 'attendno' => 'notifications_attend_item.tpl', + 'attendmaybe' => 'notifications_attend_item.tpl', + 'friend' => 'notifications_friends_item.tpl', + 'comment' => 'notifications_comments_item.tpl', + 'post' => 'notifications_posts_item.tpl', + 'notify' => 'notify.tpl', + ]; + + $tpl_notif = get_markup_template($notification_templates[$notif['label']]); $notif_content[] = replace_macros($tpl_notif, [ '$item_label' => $notif['label'], -- 2.39.5