You are here

public function UserExportPluginBase::getProfile in Open Social 8.8

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. 10.3.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  8. 10.0.x modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  9. 10.1.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

17 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 126

Class

UserExportPluginBase
Base class for User export plugin plugins.

Namespace

Drupal\social_user_export\Plugin

Code

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

  /** @var \Drupal\profile\ProfileStorageInterface $storage */
  try {
    $storage = $this->entityTypeManager
      ->getStorage('profile');
    if (!empty($storage)) {
      $user_profile = $storage
        ->loadByUser($entity, 'profile', TRUE);

      // TODO: Remove once #3005113 is fixed in the profile module.
      if ($user_profile === FALSE) {
        $user_profile = NULL;
      }
    }
  } catch (\Exception $e) {
  }
  return $user_profile;
}