You are here

public function UserExportPluginBase::getProfile in Open Social 10.1.x

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::getProfile()
  2. 8.3 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  3. 8.4 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  4. 8.5 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  5. 8.6 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  6. 8.7 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  7. 8.8 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  8. 10.3.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  9. 10.0.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  10. 10.2.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()

Get the Profile entity.

Parameters

\Drupal\user\UserInterface $entity: The user entity to get the profile from.

Return value

\Drupal\profile\Entity\ProfileInterface|null Returns the Profile or NULL if profile does not exist.

Overrides UserExportPluginInterface::getProfile

18 calls to UserExportPluginBase::getProfile()
OrganizationTag::getValue in modules/social_features/social_profile/modules/social_profile_organization_tag/src/Plugin/UserExportPlugin/OrganizationTag.php
Returns the value.
UserAddressAdministrative::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserAddressAdministrative.php
Returns the value.
UserAddressCountryCode::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserAddressCountryCode.php
Returns the value.
UserAddressLine1::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserAddressLine1.php
Returns the value.
UserAddressLine2::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserAddressLine2.php
Returns the value.

... See full list

File

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

Class

UserExportPluginBase
Base class for User export plugin plugins.

Namespace

Drupal\social_user_export\Plugin

Code

public function getProfile(UserInterface $entity) {
  $user_profile = NULL;
  try {

    /** @var \Drupal\profile\ProfileStorageInterface $storage */
    $storage = $this->entityTypeManager
      ->getStorage('profile');
    if ($storage instanceof ProfileStorageInterface) {
      $user_profile = $storage
        ->loadByUser($entity, 'profile');
    }
  } catch (\Exception $e) {
  }
  return $user_profile;
}