You are here

public static function SocialProfilePrivacyBatchHelper::updateProfileName in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.2.x modules/social_features/social_profile/modules/social_profile_privacy/src/Service/SocialProfilePrivacyBatchHelper.php \Drupal\social_profile_privacy\Service\SocialProfilePrivacyBatchHelper::updateProfileName()

Update single Profile.

Parameters

\Drupal\profile\Entity\ProfileInterface $profile: The profile.

2 calls to SocialProfilePrivacyBatchHelper::updateProfileName()
SocialProfilePrivacyBatchHelper::updateProcess in modules/social_features/social_profile/modules/social_profile_privacy/src/Service/SocialProfilePrivacyBatchHelper.php
Process operation to update content retrieved from init operation.
_social_profile_privacy_fields_submit in modules/social_features/social_profile/modules/social_profile_privacy/social_profile_privacy.module
Save fields visibility options for a user.

File

modules/social_features/social_profile/modules/social_profile_privacy/src/Service/SocialProfilePrivacyBatchHelper.php, line 122

Class

SocialProfilePrivacyBatchHelper
Class SocialProfilePrivacyBatchHelper.

Namespace

Drupal\social_profile_privacy\Service

Code

public static function updateProfileName(ProfileInterface $profile) {
  if ($profile instanceof ProfileInterface) {

    /** @var \Drupal\social_profile\SocialProfileNameService $profile_name_service */
    $profile_name_service = \Drupal::service('social_profile.name_service');

    // Get generated profile name.
    $profile_name = $profile_name_service
      ->getProfileName($profile);

    // Update profile name and save.
    $profile
      ->set('profile_name', $profile_name);
    $profile
      ->save();
  }
}