protected function SimpleFbConnectFbManager::getPreferredResolution in Simple FB Connect 8.2
Same name and namespace in other branches
- 8.3 src/SimpleFbConnectFbManager.php \Drupal\simple_fb_connect\SimpleFbConnectFbManager::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
1 call to SimpleFbConnectFbManager::getPreferredResolution()
- SimpleFbConnectFbManager::getFbProfilePicUrl in src/
SimpleFbConnectFbManager.php - Makes an API call to get the URL of user's Facebook profile picture.
File
- src/
SimpleFbConnectFbManager.php, line 333 - Contains \Drupal\simple_fb_connect\SimpleFbConnectFbManager.
Class
- SimpleFbConnectFbManager
- Contains all Simple FB Connect logic that is related to Facebook interaction.
Namespace
Drupal\simple_fb_connectCode
protected function getPreferredResolution() {
$field_definitions = $this->entityFieldManager
->getFieldDefinitions('user', 'user');
if (!isset($field_definitions['user_picture'])) {
return FALSE;
}
$max_resolution = $field_definitions['user_picture']
->getSetting('max_resolution');
$min_resolution = $field_definitions['user_picture']
->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(
'width' => $dimensions[0],
'height' => $dimensions[1],
);
}