Problem
I use this module to make an Order Item field editable on Drupal Commerce Cart page. Multilingual site.
After updating the module to beta8 i get the error below when removing an order item from the cart.
Same thing works with beta7.
Updating the field value works fine using the "Update cart" button.
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\views_entity_form_field\Plugin\views\field\EntityFormField::getEntityTranslation() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /var/www/app/web/modules/contrib/views_entity_form_field/src/Plugin/views/field/EntityFormField.php on line 608 in Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->getEntityTranslation() (line 69 of core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php).
Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->getEntityTranslation(NULL, Object) (Line: 608)
Drupal\views_entity_form_field\Plugin\views\field\EntityFormField->saveEntities(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('views_form_commerce_cart_form_default_71', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm(Object, Object, Array) (Line: 2274)
Drupal\views\Plugin\views\display\DisplayPluginBase->elementPreRender(Array)
call_user_func_array(Array, Array) (Line: 100)
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. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725', 'silenced_deprecation', '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: 444)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
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: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->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: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Steps to reproduce
Install Drupal, Drupal Commerce, and this module.
Install a second language.
Add a textarea field to the default Commerce Order Item type.
Edit 'Cart Form' view so that it has the textarea field as an editable field.
Add something to cart.
Go to cart form (/cart) and click "Remove" button.
Just wanted to report quickly, happy to help investigate further if I get instructions.
(I'm not a backend dev, sorry.)
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | views_entity_form_field-3179214-3.patch | 1.32 KB | star-szr |
| #2 | 3179214-cart-removal-1.patch | 1.18 KB | martinhansen |
Comments
Comment #2
martinhansen commentedI have the exact same problem. I'm using 8.x-1.0-beta9 on drupal 9.0.6.
Attached the change I'm trying out which is working so far, but we'll see... sorry the patch file might not be the exact right format, but should give you the idea at least.
Comment #3
star-szrUploading a valid patch for that change so it can be applied with composer.
Comment #4
chrisla commentedI experienced the same issue. My site is not multilingual. Updating issue title to reflect.
Patch from #3 works for me. Thank you!
Comment #5
chrisla commentedComment #6
4kant commented#3 works for me too.
Thanks!
Comment #8
vladimirausThank you for your contributions. 🙏
Committed! 🍻