private function ActivityNotifications::getNotificationIds in Open Social 8.5
Same name and namespace in other branches
- 8.9 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.2 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.3 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.4 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.6 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.7 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 8.8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.3.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.0.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.1.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
- 10.2.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
Returns the Activity ids for an account with destination 'notification'.
Parameters
\Drupal\Core\Session\AccountInterface $account: Account object.
array $status: Array of statuses.
\Drupal\Core\Entity\EntityBase $entity: Optionally provide a related entity to get the activities for.
Return value
array Returns an array of notification ids.
5 calls to ActivityNotifications::getNotificationIds()
- ActivityNotifications::getNotifications in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Returns the Notifications for a given account.
- ActivityNotifications::getNotificationsActivities in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Returns the Activity objects with destination 'notification' for account.
- ActivityNotifications::markAllNotificationsAsSeen in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Mark all notifications as Seen for account.
- ActivityNotifications::markEntityAsRead in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Mark an entity as read for a given account.
- ActivityNotifications::markEntityNotificationsAsRead in modules/
custom/ activity_creator/ src/ ActivityNotifications.php - Mark Notifications as Read for given account and entity..
File
- modules/
custom/ activity_creator/ src/ ActivityNotifications.php, line 143
Class
- ActivityNotifications
- Class ActivityNotifications to get Personalised activity items for account.
Namespace
Drupal\activity_creatorCode
private function getNotificationIds(AccountInterface $account, array $status = [], EntityBase $entity = NULL) {
$destinations = [
'notifications',
];
$uid = $account
->id();
$entity_query = \Drupal::entityQuery('activity');
$entity_query
->condition('field_activity_recipient_user', $uid, '=');
$entity_query
->condition('field_activity_destinations', $destinations, 'IN');
if ($entity !== NULL) {
$entity_type = $entity
->getEntityTypeId();
$entity_id = $entity
->id();
$entity_query
->condition('field_activity_entity.target_id', $entity_id, '=');
$entity_query
->condition('field_activity_entity.target_type', $entity_type, '=');
}
if (!empty($status)) {
$entity_query
->condition('field_activity_status', $status, 'IN');
}
$ids = $entity_query
->execute();
return $ids;
}