public function ActivityNotifications::markAllNotificationsAsSeen in Open Social 8.3
Same name and namespace in other branches
- 8.9 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 8.2 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 8.4 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 8.5 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 8.6 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 8.7 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 8.8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 10.3.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 10.0.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 10.1.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
- 10.2.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::markAllNotificationsAsSeen()
Mark all notifications as Seen for account.
Parameters
\Drupal\Core\Session\AccountInterface $account: Account object.
Return value
int Number of remaining notifications.
File
- modules/
custom/ activity_creator/ src/ ActivityNotifications.php, line 60
Class
- ActivityNotifications
- Class ActivityNotifications to get Personalised activity items for account.
Namespace
Drupal\activity_creatorCode
public function markAllNotificationsAsSeen(AccountInterface $account) {
// Retrieve all the activities referring this entity for this account.
$ids = $this
->getNotificationIds($account, [
ACTIVITY_STATUS_RECEIVED,
]);
foreach ($ids as $activity_id) {
$activity = Activity::load($activity_id);
$this
->changeStatusOfActivity($activity, ACTIVITY_STATUS_SEEN);
}
$remaining_notifications = 0;
return $remaining_notifications;
}