You are here

public function ContentReportActivityContext::getRecipients in Open Social 10.0.x

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.5 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  3. 8.6 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  4. 8.7 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  5. 8.8 modules/social_features/social_content_report/src/Plugin/ActivityContext/ContentReportActivityContext.php \Drupal\social_content_report\Plugin\ActivityContext\ContentReportActivityContext::getRecipients()
  6. 10.3.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.

Parameters

array $data: The data.

int $last_id: The last ID.

int $limit: The limit.

Return value

array An associative array of recipients, containing the following key-value pairs:

  • target_type: The entity type ID.
  • target_id: The entity ID.

Overrides ActivityContextBase::getRecipients

File

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

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;
}