public function EntityAvatarIdentifier::setEntity in Avatar Kit 8.2
Set the entity for this identifier.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: An entity.
Return value
$this This object.
Overrides EntityAvatarIdentifierInterface::setEntity
File
- src/
EntityAvatarIdentifier.php, line 34
Class
- EntityAvatarIdentifier
- An entity identifier.
Namespace
Drupal\avatarsCode
public function setEntity(EntityInterface $entity) : EntityAvatarIdentifierInterface {
$this->entity = $entity;
$raw = $this
->tokenReplace($entity);
if (empty($raw)) {
throw new AvatarKitEntityAvatarIdentifierException('Pre hashed string is empty after token replacement.');
}
$this
->setRaw($raw);
return $this;
}