You are here

public function ContentReportActivityContext::getRecipients in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  2. 8.6 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  3. 8.7 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  4. 8.8 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  5. 10.3.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  6. 10.0.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  7. 10.1.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  8. 10.2.x modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()

Returns a batched list of recipients for this context.

Format array( array ( id = uid or gip type = "user / group" ) )

Overrides ActivityContextBase::getRecipients

File

modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php, line 21

Class

ContentReportActivityContext
Provides a 'ContentReportActivityContext' activity context.

Namespace

Drupal\social_content_report\Plugin\ActivityContext

Code

public function getRecipients(array $data, $last_uid, $limit) {
  $recipients = [];
  $ids = $this->entityTypeManager
    ->getStorage('user')
    ->getQuery()
    ->condition('status', 1)
    ->condition('roles', $this
    ->getRolesWithPermission(), 'IN')
    ->execute();
  if (!empty($ids)) {

    // Create a list of recipients in the expected format.
    foreach ($ids as $uid) {
      $recipients[] = [
        'target_type' => 'user',
        'target_id' => $uid,
      ];
    }
  }
  return $recipients;
}