- Issue created by @EthanT
- ๐บ๐ธUnited States dave reid Nebraska USA
There's no reason that entityTypeManager shouldn't be set with dependency injection.
- Status changed to Postponed: needs info
11 months ago 3:54pm 12 December 2023 - ๐บ๐ธUnited States dave reid Nebraska USA
I cannot replicate this failure in tests or locally either. Can you help provide some steps to reproduce this issue?
- ๐บ๐ธUnited States edmund.dunn Olympia, WA
This is occurring for us as well. When I stepped through the first time entityTypeManager was injected correctly, everything appeared to be working correctly. The second time, see attached screen recording, it was not there. The entity type is loaded correctly, but entityTypeManager = null.
Feel free to pull down https://github.com/department-of-veterans-affairs/va.gov-cms. It runs on ddev.
ddev pull va --skip-files
gets you the database.Full error is:
Error: Call to a member function getStorage() on null in Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget->formElementEntities() (line 759 of modules/contrib/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php).
Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget->formElement(Object, 0, Array, Array, Object) (Line: 130)
Drupal\entity_browser_table\Plugin\Field\FieldWidget\EntityReferenceBrowserTableWidget->formElement(Object, 0, Array, Array, Object) (Line: 342)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 92)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 183)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 669)
Drupal\paragraphs\Plugin\Field\FieldWidget\InlineParagraphsWidget->formElement(Object, 0, Array, Array, Object) (Line: 342)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 849)
Drupal\paragraphs\Plugin\Field\FieldWidget\InlineParagraphsWidget->formMultipleElements(Object, Array, Object) (Line: 111)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object, NULL) (Line: 968)
Drupal\paragraphs\Plugin\Field\FieldWidget\InlineParagraphsWidget->form(Object, Array, Object) (Line: 183)
Drupal\Core\Entity\Entity\EntityFormDisplay->buildForm(Object, Array, Object) (Line: 121)
Drupal\Core\Entity\ContentEntityForm->form(Array, Object) (Line: 127)
Drupal\node\NodeForm->form(Array, Object) (Line: 107)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('node_step_by_step_form', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 68)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19) - Status changed to Active
11 months ago 3:33pm 18 December 2023 - ๐บ๐ธUnited States wells Seattle, WA
I'm also experiencing this issue however the patch here just leads to an exception further down the line:
Error: Call to a member function load() on null in Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget->formElementEntities() (line 831 of /app/docroot/modules/contrib/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php).
- ๐ฎ๐ณIndia chetan 11
chetan 11 โ made their first commit to this issueโs fork.
- Status changed to Needs review
11 months ago 5:40am 19 December 2023 - ๐ฑ๐นLithuania Evaldas Uลพkuras Kaunas, LT
This issue is caused by ๐ Cleanup plugin constructors Fixed and the release 8.x-2.10 of Entity Browser.
entity_browser_table module does not support newly implemented plugin construction logic so the required dependencies is not set.
There is an issue for that module ๐ Error: Call to a member function getStorage() on null RTBC
- ๐บ๐ธUnited States edmund.dunn Olympia, WA
I am not sure that @EthanT 's solution is ideal. We have cases where it is still needed and is not being injected. I am wondering if there is something to do with the recent changes to using the create() methods to inject? Although why it works the first time and not the second (see video) is the true mystery.
- ๐ฑ๐นLithuania Evaldas Uลพkuras Kaunas, LT
@edmund.dunn possibly that in your example it loads two different widgets in that page.
I marked differences in traces from your video (images attached) - ๐บ๐ธUnited States edmund.dunn Olympia, WA
@evaldas-uลพkuras, that is a good point. The combination of your patch here, and the patch you added for entity_browser_table seemed to fix our issue. We will be doing some more testing here in the next couple of weeks. Nice work!
- ๐บ๐ธUnited States edmund.dunn Olympia, WA
Posting the static patch because using the MR doesn't allow pinning to a specific commit, so anyone can submit pretty much anything and inject it into our codebase IIRC. This also fixed our issue. Again, nice work!!
- ๐ฎ๐ณIndia junaidpv Kannur, Kerala
Faced same issue with the crop_image โ module as a field widget from that module extends FileBrowserWidget from the entity_browser module. I already made a new release of the crop_image module to fix the issue.
So, any other module out there extending plugins of the entity_browser module are going to get hit with this. Those module will be required to update anyway.
- ๐บ๐ธUnited States swirt Florida
This problem first appeared in 8.x-2.10 โ so it seems odd to me that this fix does not look at what introduced this bug in the latest release and does a lot of gymnastics to load an entity that should be there originally, and was there just one version ago. This patch solves the problem but it does so by hiding the root problem.
- ๐บ๐ธUnited States edmund.dunn Olympia, WA
Turns out this patch was no longer necessary to fix our issue once we applied the patch from entity_browser_table.
- ๐บ๐ธUnited States swirt Florida
It seems like this issue might be able to be closed based on the solution in ๐ Error: Call to a member function getStorage() on null RTBC
- ๐ง๐ชBelgium michiellucas
When going from D9 to D10 we get this error
like the create function is not called
The website encountered an unexpected error. Try again later.
Error: Call to a member function getStorage() on null in Drupal\entity_browser\Plugin\Field\FieldWidget\EntityReferenceBrowserWidget->settingsForm() (line 124 of modules/contrib/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php).
Drupal\entity_browser\Plugin\Field\FieldWidget\FileBrowserWidget->settingsForm(Array, Object) (Line: 156)
Drupal\image_browser_widget_crop\Plugin\Field\FieldWidget\ImageCropFileBrowserWidget->settingsForm(Array, Object) (Line: 450)
Drupal\field_ui\Form\EntityDisplayFormBase->buildFieldRow(Object, Array, Object) (Line: 40) - ๐ฑ๐นLithuania Evaldas Uลพkuras Kaunas, LT
@michiellucas problem is with your code in
Drupal\image_browser_widget_crop\Plugin\Field\FieldWidget\ImageCropFileBrowserWidget`create` and `__construct` methods have to be aligned with latest version of entity_browser module.
- ๐ต๐ญPhilippines mjgruta
The same error is happening with entity_browser_table. The patch in this issue works for us.
https://www.drupal.org/project/entity_browser_table/issues/3408217 ๐ Error: Call to a member function getStorage() on null RTBC - ๐ฌ๐งUnited Kingdom the_g_bomb
I haven't fully tested the patch in #24, but I can see there is a coding standard issue to address.
- Status changed to Needs work
5 months ago 6:34pm 10 June 2024 - ๐จ๐ญSwitzerland berdir Switzerland
Yes, that patch is wrong, we can't just not run the logic. What should be done, should have been done in the original issue is to fallback to the \Drupal::entityTypeManager() if that's not provided.