Problem/Motivation

It is not possible to change the unlocked and locked image for the achievements. Only the default ones work.
If you try to change it, WSOD with this error:

Error: Call to a member function get() on null in Drupal\achievements\Form\AchievementEntityForm->submitForm() (line 228 of modules/contrib/achievements/src/Form/AchievementEntityForm.php).

Steps to reproduce

  1. Install achievement 2.x-dev or 3.x-dev.
  2. On achievement type create a new type.
  3. Disable default image.
  4. Compile one or more of the fields related to the image.
  5. Click save.

Also tested on simplytest.me with achievement 2.x-dev and Drupal 9.5.1

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sepa_cleversoft created an issue.

nico.b made their first commit to this issue’s fork.

nico.b’s picture

There actually seem to be two errors with the image upload and path.

First, as described above,

Error: Call to a member function get() on null in Drupal\achievements\Form\AchievementEntityForm->submitForm() (line 228 of modules/contrib/achievements/src/Form/AchievementEntityForm.php).

appears when uploading an image. If setting the path manually, another error occurs due to the usage of deprecated/removes APIs:

Error: Call to undefined method Drupal\Core\File\FileSystem::uriScheme() in Drupal\achievements\Form\AchievementEntityForm->validatePath() (line 209 of modules/contrib/achievements/src/Form/AchievementEntityForm.php)

I submitted a patch (as a merge request) that should fix both issues.

I'd appreciate a review.

grasmash’s picture

Related changes were made here: https://www.drupal.org/project/achievements/issues/3182487

Is this still an issue?