Problem/Motivation

In Drupal 10 ImageBase64Formatter field formatter is triggering the error:
ArgumentCountError: Too few arguments to function Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter::__construct(), 9 passed in /app/docroot/modules/contrib/image_base64_formatter/src/Plugin/Field/FieldFormatter/ImageBase64Formatter.php on line 66 and exactly 10 expected in Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter->__construct() (line 75 of /app/docroot/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php).

Steps to reproduce

In drupal 10 clean install render an image using image_base64 field formatter

Proposed resolution

Add missing FileUrlGeneratorInterface $file_url_generator parameter for ImageFormatter::__construct

Comments

aalin created an issue. See original summary.

aalin’s picture

Patch added

aalin’s picture

Status: Active » Needs review
vuil’s picture

vuil’s picture

StatusFileSize
new2.62 KB

I can reproduce it too.

ArgumentCountError: Too few arguments to function Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter::__construct(), 9 passed in /var/www/web/modules/custom/image_base64_formatter/src/Plugin/Field/FieldFormatter/ImageBase64Formatter.php on line 64 and exactly 10 expected in Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter->__construct() (line 75 of /var/www/web/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php).

The patch of #2 does not work for me on Drupal 10.1 release. I post my patch here.

  • vuil committed db01b981 on 2.0.x
    Issue #3370958 by aalin, vuil: Drupal 10 ImageFormatter::__construct...
vuil’s picture

Status: Needs review » Fixed

@aalin Thank you very much about the issue creation.

The solution will be integrated in the new module release within a minute.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rmorelli’s picture

Not fixed in dev-2.0.x 2d422a9
PHP 8.2.18
regards

vuil’s picture

Status: Closed (fixed) » Needs work

I re-opened the issue.

Any suggestions?
Could you also paste your error message.

Thank you.

rmorelli’s picture

Error message is the same but I finally solved using this merge request (never accepted)
https://git.drupalcode.org/project/formatter_suite/-/merge_requests/2/di...

vuil’s picture

Status: Needs work » Fixed

Already resolved in the latest stable version. The issue is Fixed.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.