You are here

Adorable.php in Avatar Kit 8

File

avatars_adorable/src/Plugin/AvatarGenerator/Adorable.php
View source
<?php

namespace Drupal\avatars_adorable\Plugin\AvatarGenerator;

use Drupal\avatars\Plugin\AvatarGenerator\AvatarGeneratorBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\avatars_adorable\Adorable as AdorableAPI;

/**
 * Adorable.io avatar generator.
 *
 * @AvatarGenerator(
 *   id = "adorable",
 *   label = @Translation("Adorable"),
 *   description = @Translation("Adorable avatars by adorable.io"),
 *   fallback = TRUE,
 *   dynamic = FALSE,
 *   remote = TRUE
 * )
 */
class Adorable extends AvatarGeneratorBase {

  /**
   * {@inheritdoc}
   */
  public function generateUri(AccountInterface $account) {
    $api = new AdorableAPI();
    return $api
      ->setIdentifier($this
      ->getIdentifier($account))
      ->setDimensions(256)
      ->getUrl();
  }

}

Classes

Namesort descending Description
Adorable Adorable.io avatar generator.