- Issue created by @Thomas Kaisuka
- Status changed to Needs review
5 months ago 7:37am 27 June 2024 - 🇮🇳India sarwan_verma
Hi @Thomas Kaisuka,
I have resolved this issue "Error: Class "Drupal\bg_img_field\Plugin\Field\FieldFormatter\File" not found in Drupal\bg_img_field\Plugin\Field\FieldFormatter\BgImgFieldFormatter->viewElements()" and also attached the patch,
please review and verify. - 🇮🇳India Sandeep_k New Delhi
Hi @sarwan_verma, I've tested shared Patch- bg_img_field-3452677 on Drupal version- 10.3-dev. The patch was applied successfully but the error is still does not fixed for me, Added before and after patch results.
- 🇺🇸United States NicholasS
10.3 I get
Error: Call to a member function load() on null in Drupal\bg_img_field\Plugin\Field\FieldFormatter\BgImgFieldFormatter->viewElements() (line 188 of modules/contrib/bg_img_field/src/Plugin/Field/FieldFormatter/BgImgFieldFormatter.php).
which is the same line this issue has a problem with. - 🇺🇸United States NicholasS
Plus I get
Warning: Undefined variable $fileSystem in Drupal\bg_img_field\Plugin\Field\FieldFormatter\BgImgFieldFormatter->__construct() (line 117 of modules/contrib/bg_img_field/src/Plugin/Field/FieldFormatter/BgImgFieldFormatter.php).
and
Warning: Undefined variable $imageFactory in Drupal\bg_img_field\Plugin\Field\FieldFormatter\BgImgFieldFormatter->__construct() (line 118 of modules/contrib/bg_img_field/src/Plugin/Field/FieldFormatter/BgImgFieldFormatter.php).
So not sure how 2.1 release is working for anyone! But the undefined vars probably explains your original issue.
- 🇺🇸United States NicholasS
I started a new issue but check out https://www.drupal.org/project/bg_img_field/issues/3484950 🐛 Error: Call to a member function load() on null BgImgFieldFormatter Active and see if it solves your orginal error, I never got your exact error, but I assume it stems from the same bad code.
- 🇺🇸United States John Franklin
Closing as a duplicate of 🐛 Error: Call to a member function load() on null BgImgFieldFormatter Active .