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;
  }
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;
  }
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 ; }
Ajax callback to mark notifications as read.
Ajax callback to mark notifications as read .