Problem/Motivation
After installing this module, try to access /admin/config/media/smart-image-optimizer. A fatal error occurs, as shown below:
ArgumentCountError: Too few arguments to function Drupal\Core\Form\ConfigFormBase::__construct(), 1 passed in /var/www/html/xxxxxx/web/modules/contrib/smart_image_optimizer/src/Form/SettingsForm.php on line 33 and exactly 2 expected in Drupal\Core\Form\ConfigFormBase->__construct() (line 46 of /var/www/html/xxxxx/web/core/lib/Drupal/Core/Form/ConfigFormBase.php).
Steps to reproduce
- Install Drupal 11.x
- Install the smart_image_optimizer module
- Navigate to /admin/config/media/smart-image-optimizer
Expected
The Smart Image Optimizer settings form loads correctly without any errors.
Actual
Fatal error: ArgumentCountError: Too few arguments to function...
Proposed resolution
Update SettingsForm::__construct() and SettingsForm::create()
Comments
Comment #3
dkmishra commentedComment #4
vinodhini.e commentedHi,
Tested on Drupal 11.4.5 and was able to reproduce the issue.
Applied MR !3 and retested.
The settings page now loads correctly without any errors, and the issue is resolved.
Comment #7
nishantMR merged,
Thanks @vinodhini.e and @dkmishra.
Comment #8
nishantComment #10
nishant