You are here

private function ActivityNotifications::getNotificationIds in Open Social 8.3

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  2. 8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  3. 8.2 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  4. 8.4 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  5. 8.5 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  6. 8.6 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  7. 8.7 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  8. 8.8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  9. 10.3.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  10. 10.0.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  11. 10.1.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationIds()
  12. 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\Entity $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 144

Class

ActivityNotifications
Class ActivityNotifications to get Personalised activity items for account.

Namespace

Drupal\activity_creator

Code

private function getNotificationIds(AccountInterface $account, array $status = [], Entity $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;
}