public function ActivityContextBase::getRecipientsFromPost in Open Social 8.9
Same name and namespace in other branches
- 8 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 8.2 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 8.3 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 8.4 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 8.5 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 8.6 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 8.7 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 8.8 modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 10.3.x modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 10.0.x modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 10.1.x modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
- 10.2.x modules/custom/activity_creator/src/Plugin/ActivityContextBase.php \Drupal\activity_creator\Plugin\ActivityContextBase::getRecipientsFromPost()
Returns recipients from post.
Parameters
array $referenced_entity: The referenced entity.
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.
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 110 
Class
- ActivityContextBase
- Base class for Activity context plugin plugins.
Namespace
Drupal\activity_creator\PluginCode
public function getRecipientsFromPost(array $referenced_entity) {
  $recipients = [];
  $post = $this->entityTypeManager
    ->getStorage('post')
    ->load($referenced_entity['target_id']);
  if ($post !== NULL && !$post->field_recipient_user
    ->isEmpty()) {
    $recipients[] = [
      'target_type' => 'user',
      'target_id' => $post->field_recipient_user->target_id,
    ];
  }
  return $recipients;
}