You are here

public function UserExportPluginBase::profileGetFieldValue in Open Social 8.9

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

Returns the value of a field for a given profile.

Parameters

string $field_name: The field name to get the value for.

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

Return value

string Returns value of the field.

Overrides UserExportPluginInterface::profileGetFieldValue

7 calls to UserExportPluginBase::profileGetFieldValue()
UserFirstName::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserFirstName.php
Returns the value.
UserFunction::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserFunction.php
Returns the value.
UserLastName::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserLastName.php
Returns the value.
UserNickName::getValue in modules/social_features/social_profile/modules/social_profile_fields/src/Plugin/UserExportPlugin/UserNickName.php
Returns the value.
UserOrganization::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserOrganization.php
Returns the value.

... See full list

File

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

Class

UserExportPluginBase
Base class for User export plugin plugins.

Namespace

Drupal\social_user_export\Plugin

Code

public function profileGetFieldValue($field_name, ProfileInterface $user_profile = NULL) {
  if ($user_profile === NULL) {
    return '';
  }
  try {
    $value = $user_profile
      ->get($field_name)->value;
  } catch (\Exception $e) {
    $value = '';
  }
  return $value;
}