You are here

public function UserManager::getPictureDirectory in Open Social 8.4

Same name and namespace in other branches
  1. 8.9 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()
  2. 8 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()
  3. 8.2 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()
  4. 8.3 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()
  5. 8.5 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()
  6. 8.6 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()
  7. 8.7 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()
  8. 8.8 modules/custom/social_auth_extra/src/UserManager.php \Drupal\social_auth_extra\UserManager::getPictureDirectory()

Returns directory path to save picture.

Return value

bool|string Directory path or FALSE when error has occurred.

Overrides UserManagerInterface::getPictureDirectory

1 call to UserManager::getPictureDirectory()
UserManager::downloadProfilePicture in modules/custom/social_auth_extra/src/UserManager.php
Saves the picture from URL.

File

modules/custom/social_auth_extra/src/UserManager.php, line 168

Class

UserManager
Class UserManager.

Namespace

Drupal\social_auth_extra

Code

public function getPictureDirectory() {
  if ($this->fieldPicture instanceof FieldDefinitionInterface) {

    // Prepare directory where downloaded image will be saved.
    $scheme = $this->configFactory
      ->get('system.file')
      ->get('default_scheme');
    $directory = $this->fieldPicture
      ->getSetting('file_directory');
    $directory = "{$scheme}://{$directory}";
    $directory = $this->token
      ->replace($directory);
    $directory = $this->transliteration
      ->transliterate($directory, 'en', '_', 50);
    return $directory;
  }
  return FALSE;
}