public function AvatarKitEntityFieldHandler::getAvatarFieldName in Avatar Kit 8.2
Get field name for avatars.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Get the field name for this entity.
Return value
string|null The field name, or NULL if no field name is defined.
Overrides AvatarKitEntityFieldHandlerInterface::getAvatarFieldName
3 calls to AvatarKitEntityFieldHandler::getAvatarFieldName()
- AvatarKitEntityFieldHandler::checkUpdates in src/
AvatarKitEntityFieldHandler.php - Checks if there are updates to the first avatar for an entity.
- AvatarKitEntityFieldHandler::copyCacheToEntity in src/
AvatarKitEntityFieldHandler.php - Copies the avatar in a cache entity to an entity.
- AvatarKitEntityFieldHandler::getAvatarFieldConfig in src/
AvatarKitEntityFieldHandler.php - Get target field configuration for an entity.
File
- src/
AvatarKitEntityFieldHandler.php, line 93
Class
- AvatarKitEntityFieldHandler
- Handles pushing avatar caches into entities.
Namespace
Drupal\avatarsCode
public function getAvatarFieldName(EntityInterface $entity) : ?string {
$entity_type = $entity
->getEntityTypeId();
$bundle = $entity
->bundle();
$entity_map = AvatarKitEntityMap::load($entity_type . '.' . $bundle . '.' . 'default');
return $entity_map ? $entity_map
->getFieldName() : NULL;
}