You are here

public function AuthManager::getPreferredResolution in Open Social 8.8

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

Determines preferred profile pic resolution from account settings.

Return order: max resolution, min resolution, FALSE.

Return value

array|false Array of resolution, if defined in Drupal account settings. False otherwise.

Overrides AuthManagerInterface::getPreferredResolution

1 call to AuthManager::getPreferredResolution()
FacebookAuthManager::getProfilePicture in modules/custom/social_auth_facebook/src/FacebookAuthManager.php
Returns URL of a profile picture.

File

modules/custom/social_auth_extra/src/AuthManager.php, line 65

Class

AuthManager
Class AuthManager.

Namespace

Drupal\social_auth_extra

Code

public function getPreferredResolution() {

  // Check whether field is exists.
  if (!$this->fieldPicture instanceof FieldDefinitionInterface) {
    return FALSE;
  }
  $max_resolution = $this->fieldPicture
    ->getSetting('max_resolution');
  $min_resolution = $this->fieldPicture
    ->getSetting('min_resolution');

  // Return order: max resolution, min resolution, FALSE.
  if ($max_resolution) {
    $resolution = $max_resolution;
  }
  elseif ($min_resolution) {
    $resolution = $min_resolution;
  }
  else {
    return FALSE;
  }
  $dimensions = explode('x', $resolution);
  return array_combine([
    'width',
    'height',
  ], $dimensions);
}