error is shown in case user has no image

Created on 20 May 2024, 7 months ago

Problem/Motivation

In case a user has no image (avatar), the following error is shown
Warning: Undefined variable $imageMimeType in Drupal\user_menu_avatar\Services\UserMenuAvatarServices->getFieldImage() (line 133 of modules/contrib/user_menu_avatar/src/Services/UserMenuAvatarServices.php).

Steps to reproduce

From the user configuration, remove the user image. Error is shown...

Proposed resolution

Fix the code, modifying the code near line 133 as following

      // Get the default image URI from settings.
      $image = $this->entityRepository
        ->loadEntityByUuid('file', $imageGetSettings['uuid']);

      // Get image mime type.
      $imageMimeType = $image->getMimeType();

      // Get image file URI.
      $uri = $image->getFileUri();

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

9.0

Component

Code

Created by

🇮🇹Italy veverka42

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024