You are here

public function Gravatar::setFallbackType in Avatar Kit 8

The type used for when 'gravatar' type fails.

Such as when there is no Gravatar for the hash.

Parameters

string|null $type: An avatar type.

Return value

\Drupal\avatars_gravatar\GravatarInterface Returns the called object for chaining.

Throws

\Drupal\avatars\Exception\AvatarException Thrown if the passed type is invalid.

Overrides GravatarInterface::setFallbackType

File

avatars_gravatar/src/Gravatar.php, line 112

Class

Gravatar
Implements the Gravatar.com API.

Namespace

Drupal\avatars_gravatar

Code

public function setFallbackType($type = NULL) {

  // Fallback type only applies when primary type is set to 'gravatar'.
  if (!in_array($type, $this
    ->getFallbackTypes())) {
    throw new AvatarException(sprintf('%s is an invalid fallback type', $type));
  }
  $this->fallbackType = $type;
  $this->fallbackURI = NULL;
  return $this;
}