You are here

public function Robohash::setBackground in Avatar Kit 8

Set the background.

Parameters

string|null $background: The background to use, or NULL to use default.

Return value

\Drupal\avatars_robohash\RobohashInterface Returns the called Robohash object for chaining.

Overrides RobohashInterface::setBackground

File

avatars_robohash/src/Robohash.php, line 72

Class

Robohash
Implements the Robohash.org API.

Namespace

Drupal\avatars_robohash

Code

public function setBackground($background = NULL) {
  if (!array_key_exists($background, $this
    ->getBackgrounds())) {
    throw new AvatarException('Invalid background');
  }
  $this->background = $background;
  return $this;
}