public function NotificationsController::readNotificationCallback in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 8.2 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 8.3 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 8.4 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 8.5 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 8.6 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 8.7 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 8.8 modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 10.3.x modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 10.0.x modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 10.1.x modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
- 10.2.x modules/custom/activity_creator/src/Controller/NotificationsController.php \Drupal\activity_creator\Controller\NotificationsController::readNotificationCallback()
Ajax callback to mark notifications as read.
1 string reference to 'NotificationsController::readNotificationCallback'
- activity_creator.routing.yml in modules/
custom/ activity_creator/ activity_creator.routing.yml - modules/custom/activity_creator/activity_creator.routing.yml
File
- modules/
custom/ activity_creator/ src/ Controller/ NotificationsController.php, line 16
Class
- NotificationsController
- Notifications controller.
Namespace
Drupal\activity_creator\ControllerCode
public function readNotificationCallback() {
$account = \Drupal::currentUser();
// @todo: Add dependency injection.
$activity_notifications = \Drupal::service('activity_creator.activity_notifications');
$remaining_notifications = $activity_notifications
->markAllNotificationsAsSeen($account);
// Create AJAX Response object.
// @todo: Implement a Ajax command instead and call via addCommand().
$response = new AjaxResponse();
$data = [
'remaining_notifications' => $remaining_notifications,
];
$response
->setData($data);
// Return ajax response.
return $response;
}