public function VoteActivityContext::getRecipients in Open Social 8.6
Same name and namespace in other branches
- 8.9 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 8 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 8.2 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 8.3 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 8.4 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 8.5 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 8.7 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 8.8 modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 10.3.x modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 10.0.x modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 10.1.x modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::getRecipients()
- 10.2.x modules/social_features/social_like/src/Plugin/ActivityContext/VoteActivityContext.php \Drupal\social_like\Plugin\ActivityContext\VoteActivityContext::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_like/ src/ Plugin/ ActivityContext/ VoteActivityContext.php, line 21
Class
- VoteActivityContext
- Provides a 'VoteActivityContext' activity context.
Namespace
Drupal\social_like\Plugin\ActivityContextCode
public function getRecipients(array $data, $last_uid, $limit) {
$recipients = [];
// We only know the context if there is a related object.
if (isset($data['related_object']) && !empty($data['related_object'])) {
$related_object = $data['related_object'][0];
if ($related_object['target_type'] == 'vote') {
$vote_storage = \Drupal::entityTypeManager()
->getStorage('vote');
$vote = $vote_storage
->load($related_object['target_id']);
if ($vote instanceof Vote) {
$entity_storage = \Drupal::entityTypeManager()
->getStorage($vote
->getVotedEntityType());
/** @var \Drupal\Core\Entity\EntityBase $entity */
$entity = $entity_storage
->load($vote
->getVotedEntityId());
$uid = $entity
->getOwnerId();
// Don't send notifications to myself.
if ($uid !== $data['actor']) {
$recipients[] = [
'target_type' => 'user',
'target_id' => $uid,
];
}
}
}
}
return $recipients;
}