public function Gravatar::setIdentifier in Avatar Kit 8
Sets a unique identifier to be passed to the API.
Parameters
string $identifier: A unique identifier, such as an e-mail address.
bool $pre_hashed: Whether the ID has been pre-obfuscated, otherwise it will happen when the URL is generated.
Return value
\Drupal\avatars\AvatarBaseInterface Returns the called Robohash object for chaining.
Throws
\Drupal\avatars\Exception\AvatarException Thrown if the identifier is malformed.
Overrides AvatarBase::setIdentifier
File
- avatars_gravatar/
src/ Gravatar.php, line 164
Class
- Gravatar
- Implements the Gravatar.com API.
Namespace
Drupal\avatars_gravatarCode
public function setIdentifier($identifier, $pre_hashed = FALSE) {
if ($pre_hashed && strlen($identifier) > 32) {
throw new AvatarException('API does not generate unique avatars after 32nd character.');
}
// Gravatar expects lower case email address.
if (!$pre_hashed) {
$identifier = strtolower($identifier);
}
return parent::setIdentifier($identifier, $pre_hashed);
}