You are here

public function ActivityContextBase::getRecipientsFromPost in Open Social 8

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

Returns recipients from post.

1 call to ActivityContextBase::getRecipientsFromPost()
ProfileActivityContext::getRecipients in modules/custom/activity_basics/src/Plugin/ActivityContext/ProfileActivityContext.php
Returns a batched list of recipients for this context.

File

modules/custom/activity_creator/src/Plugin/ActivityContextBase.php, line 73

Class

ActivityContextBase
Base class for Activity context plugin plugins.

Namespace

Drupal\activity_creator\Plugin

Code

public function getRecipientsFromPost(array $referenced_entity) {
  $recipients = [];
  $post = Post::load($referenced_entity['target_id']);
  $recipient_user = $post
    ->get('field_recipient_user')
    ->getValue();
  if (!empty($recipient_user)) {
    $recipients[] = [
      'target_type' => 'user',
      'target_id' => $recipient_user['0']['target_id'],
    ];
  }
  return $recipients;
}