You are here

public function ActivityNotifications::getNotificationsActivities in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  2. 8 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  3. 8.2 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  4. 8.3 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  5. 8.4 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  6. 8.5 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  7. 8.6 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  8. 8.7 modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  9. 10.3.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  10. 10.0.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  11. 10.1.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()
  12. 10.2.x modules/custom/activity_creator/src/ActivityNotifications.php \Drupal\activity_creator\ActivityNotifications::getNotificationsActivities()

Returns the Activity objects with destination 'notification' for account.

Parameters

\Drupal\Core\Session\AccountInterface $account: Account object.

array $status: Status string: activity_creator_field_activity_status_allowed_values().

Return value

array Return array of notifications as activity objects or an empty array.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

modules/custom/activity_creator/src/ActivityNotifications.php, line 75

Class

ActivityNotifications
Class ActivityNotifications to get Personalised activity items for account.

Namespace

Drupal\activity_creator

Code

public function getNotificationsActivities(AccountInterface $account, array $status = [
  ACTIVITY_STATUS_RECEIVED,
]) : array {
  if (!empty($ids = $this
    ->getNotificationIds($account, $status))) {
    return $this
      ->entityTypeManager()
      ->getStorage('activity')
      ->loadMultiple($ids);
  }
  return [];
}