You are here

public static function AvatarKitEntityHandler::createEntityIdentifier in Avatar Kit 8.2

Creates a Entity avatar identifier object for a service.

Parameters

\Drupal\avatars\Plugin\Avatars\Service\AvatarKitServiceInterface $service: An avatar service.

\Drupal\Core\Entity\EntityInterface $entity: Entity to create an identifier.

Return value

\Drupal\avatars\EntityAvatarIdentifierInterface An identifier object.

Throws

\Drupal\avatars\Exception\AvatarKitEntityAvatarIdentifierException

1 call to AvatarKitEntityHandler::createEntityIdentifier()
AvatarKitEntityHandler::findAll in src/AvatarKitEntityHandler.php
Iterates through all avatar services for a user.

File

src/AvatarKitEntityHandler.php, line 127

Class

AvatarKitEntityHandler
Downloads and caches avatars into entities.

Namespace

Drupal\avatars

Code

public static function createEntityIdentifier(AvatarKitServiceInterface $service, EntityInterface $entity) : EntityAvatarIdentifierInterface {
  $identifier = $service
    ->createIdentifier();
  $new_identifier = new EntityAvatarIdentifierProxy($identifier);
  $new_identifier
    ->setEntity($entity);
  return $new_identifier;
}