| @@ -133,16 +133,14 @@ | ||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | public function getDashboardNotifications(array &$data): void |
| 136 | 136 | { |
| 137 | - $data['dashboardNotifications'] = ''; | |
| 137 | + $data['dashboardNotifications'] = []; | |
| 138 | 138 | |
| 139 | 139 | if (empty($data['notifications'])) { |
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - $data['dashboardNotifications'] = '<div class="acym__dashboard__notifications">'; | |
| 144 | - | |
| 145 | 143 | $notifications = array_map(fn($notif) => is_array($notif) ? (object)$notif : $notif, $data['notifications']); |
| 146 | 144 | $notifications = array_filter($notifications, fn($notif) => isset($notif->message, $notif->level, $notif->date)); |
| 147 | 145 | |
| 148 | 146 | foreach ($notifications as $notif) { |
| @@ -149,35 +147,16 @@ | ||
| 149 | 147 | if ($notif->level === 'info') { |
| 150 | 148 | continue; |
| 151 | 149 | } |
| 152 | 150 | |
| 153 | - $fullMessageHover = $notif->message ?? ''; | |
| 154 | - | |
| 155 | - $fullMessageHover = ($fullMessageHover !== $notif->message) | |
| 156 | - ? 'data-acym-full="'.esc_attr($fullMessageHover).'"' | |
| 157 | - : ''; | |
| 158 | - | |
| 159 | - $logo = ($notif->level === 'warning') | |
| 160 | - ? 'acymicon-exclamation-triangle' | |
| 161 | - : 'acymicon-exclamation-circle'; | |
| 162 | - | |
| 163 | - $date = acym_date($notif->date ?? 'now', 'Y-m-d H:i:s', false); | |
| 164 | - | |
| 165 | - $data['dashboardNotifications'] .= '<div class="cell grid-x acym__dashboard__notification acym__dashboard__notification__'.$notif->level.'">' | |
| 166 | - .'<div class="cell shrink small-1 align-center grid-x acym__dashboard__notification__icon"><i class="cell shrink '.$logo.'"></i></div>' | |
| 167 | - .'<div class="cell grid-x small-10"><p class="cell acym__dashboard__notification__message" '.$fullMessageHover.'>'.$notif->message | |
| 168 | - .'<div class="cell acym__dashboard__notification__date">'.$date.'</div></div>'; | |
| 169 | - | |
| 170 | - if (!isset($notif->removable) || $notif->removable != 0) { | |
| 171 | - $data['dashboardNotifications'] .= '<i class="cell shrink small-1 acym__dashboard__notification__delete acymicon-close" data-id="'.esc_attr( | |
| 172 | - $notif->name | |
| 173 | - ).'"></i>'; | |
| 174 | - } | |
| 175 | - | |
| 176 | - $data['dashboardNotifications'] .= '</div><span class="acym__dashboard__light__separator separator"></span>'; | |
| 151 | + $data['dashboardNotifications'][] = [ | |
| 152 | + 'level' => $notif->level, | |
| 153 | + 'message' => $notif->message, | |
| 154 | + 'date' => acym_date($notif->date ?? 'now', 'Y-m-d H:i:s', false), | |
| 155 | + 'removable' => !isset($notif->removable) || $notif->removable != 0, | |
| 156 | + 'name' => $notif->name, | |
| 157 | + ]; | |
| 177 | 158 | } |
| 178 | - | |
| 179 | - $data['dashboardNotifications'] .= '</div>'; | |
| 180 | 159 | } |
| 181 | 160 | |
| 182 | 161 | private function doDisplayBeginnerSteps(array $data): void |
| 183 | 162 | { |