Problem/Motivation
Drupal 9 is throwing the below error because ::getEntityRepository() was removed from the EntityTranslationRenderTrait.
The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\views_entity_form_field\Plugin\views\field\EntityFormField::getEntityRepository() in Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->getEntityTranslation() (line 77 of core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php).
Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->getEntityTranslation(Object, Object) (Line: 490)
Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->viewsForm(Array, Object) (Line: 113)
Drupal\views\Form\ViewsFormMainForm->buildForm(Array, Object, Object, Array) (Line: 169)
Drupal\views\Form\ViewsForm->buildForm(Array, Object, Object, Array)
call_user_func_array(Array, Array) (Line: 532)
Drupal\Core\Form\FormBuilder->retrieveForm('views_form_msk_patient_ed_resources_admin_review_default+embed+external+external-video+presentation+video+webcasts', Object) (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm(Object, Object, Array) (Line: 2258)
Drupal\views\Plugin\views\display\DisplayPluginBase->elementPreRender(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 781)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 372)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
Try to load view that using this module
Proposed resolution
Add \Drupal\views_entity_form_field\Plugin\views\field\EntityFormField::getEntityRepository method
Remaining tasks
Write patch
Review patch
Commit patch
User interface changes
N/A
API changes
Add ::getEntityRepository to \Drupal\views_entity_form_field\Plugin\views\field\EntityFormField.
Data model changes
N/A