You are here

protected function ActivityFactory::getFieldRecipientUser in Open Social 10.3.x

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

Get field value for 'recipient_user' field from data array.

1 call to ActivityFactory::getFieldRecipientUser()
ActivityFactory::buildActivities in modules/custom/activity_creator/src/ActivityFactory.php
Build the activities based on a data array.

File

modules/custom/activity_creator/src/ActivityFactory.php, line 435

Class

ActivityFactory
Class ActivityFactory to create Activity items based on ActivityLogs.

Namespace

Drupal\activity_creator

Code

protected function getFieldRecipientUser($data) {
  $value = NULL;
  $user_recipients = [];
  if (isset($data['recipient']) && is_array($data['recipient'])) {

    // Get activities by type and check when there are users entities.
    $activity_by_type = array_column($data['recipient'], 'target_type');
    foreach ($activity_by_type as $recipients_key => $target_type) {
      if ($target_type === 'user') {
        $user_recipients[] = $data['recipient'][$recipients_key];
      }
    }
    if (!empty($user_recipients)) {
      $value = $user_recipients;
    }
  }
  return $value;
}