You are here

public function UserExportPluginBase::profileGetTaxonomyFieldValue in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  2. 8.3 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  3. 8.4 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  4. 8.5 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  5. 8.6 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  6. 8.8 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  7. 10.3.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  8. 10.0.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  9. 10.1.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()
  10. 10.2.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::profileGetTaxonomyFieldValue()

Returns the values of a taxonomy reference field.

Parameters

string $field_name: The field name to get the value for, should be taxonomy term reference.

\Drupal\profile\Entity\ProfileInterface $user_profile: The profile to get the data for.

Return value

string Returns comma separated string of taxonomy terms of the field.

Overrides UserExportPluginInterface::profileGetTaxonomyFieldValue

4 calls to UserExportPluginBase::profileGetTaxonomyFieldValue()
OrganizationTag::getValue in modules/social_features/social_profile/modules/social_profile_organization_tag/src/Plugin/UserExportPlugin/OrganizationTag.php
Returns the value.
UserInterests::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserInterests.php
Returns the value.
UserProfileTag::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserProfileTag.php
Returns the value.
UserSkills::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserSkills.php
Returns the value.

File

modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php, line 213

Class

UserExportPluginBase
Base class for User export plugin plugins.

Namespace

Drupal\social_user_export\Plugin

Code

public function profileGetTaxonomyFieldValue($field_name, ProfileInterface $user_profile = NULL) {
  if ($user_profile === NULL) {
    return '';
  }
  $names = array_map(function (TermInterface $taxonomy_term) {
    return $taxonomy_term
      ->getName();
  }, $user_profile
    ->get($field_name)
    ->referencedEntities());
  return implode(', ', $names);
}