diff --git a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx index fade92a..f54768f 100644 --- a/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx +++ b/admin-spa/src/routes/Settings/Notifications/EditTemplate.tsx @@ -221,18 +221,20 @@ export default function EditTemplate() { size="sm" onClick={() => navigate(-1)} className="gap-2" + title={__('Back')} > - {__('Back')} + {__('Back')} } diff --git a/includes/Api/NotificationsController.php b/includes/Api/NotificationsController.php index 91ccfc2..3d3ec89 100644 --- a/includes/Api/NotificationsController.php +++ b/includes/Api/NotificationsController.php @@ -13,8 +13,6 @@ use WP_REST_Request; use WP_REST_Response; use WP_Error; use WooNooW\Core\Notifications\TemplateProvider; -use WooNooW\Core\Notifications\EventProvider; -use WooNooW\Core\Notifications\ChannelProvider; use WooNooW\Core\Notifications\PushNotificationHandler; class NotificationsController { @@ -562,11 +560,16 @@ class NotificationsController { } // Add event and channel labels for UI - $events = EventProvider::get_events(); - $channels = ChannelProvider::get_channels(); + // Get events from controller method + $events_response = $this->get_events(new WP_REST_Request()); + $events_data = $events_response->get_data(); + + // Get channels from controller method + $channels_response = $this->get_channels(new WP_REST_Request()); + $channels_data = $channels_response->get_data(); // Find event label - foreach ($events as $category => $event_list) { + foreach ($events_data as $category => $event_list) { foreach ($event_list as $event) { if ($event['id'] === $event_id) { $template['event_label'] = $event['label']; @@ -576,7 +579,7 @@ class NotificationsController { } // Find channel label - foreach ($channels as $channel) { + foreach ($channels_data as $channel) { if ($channel['id'] === $channel_id) { $template['channel_label'] = $channel['label']; break;