You are here

public function UserExportPluginBase::getProfile in Open Social 8.3

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.4 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  3. 8.5 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  4. 8.6 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  5. 8.7 modules/social_features/social_user_export/src/Plugin/UserExportPluginBase.php \Drupal\social_user_export\Plugin\UserExportPluginBase::getProfile()
  6. 8.8 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

16 calls to UserExportPluginBase::getProfile()
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.
UserAddressLocality::getValue in modules/social_features/social_user_export/src/Plugin/UserExportPlugin/UserAddressLocality.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;
}