Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
If an image field has fewer than the maximum allowed number of values in field settings, the node edit page will crash with the error, "The website encountered an unexpected error. Please try again later"
Error: Call to a member function getDisplay() on null in Drupal\entity_browser\Element\EntityBrowserElement::processEntityBrowser() (line 163 of /var/www/html/modules/entity_browser/src/Element/EntityBrowserElement.php) #0 [internal function]: Drupal\entity_browser\Element\EntityBrowserElement::processEntityBrowser(Array, Object(Drupal\Core\Form\FormState), Array) #1 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(981): call_user_func_array(Array, Array) #2 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(1044): Drupal\Core\Form\FormBuilder->doBuildForm('node_brand_edit...', Array, Object(Drupal\Core\Form\FormState)) #3 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(1044): Drupal\Core\Form\FormBuilder->doBuildForm('node_brand_edit...', Array, Object(Drupal\Core\Form\FormState)) #4 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(1044): Drupal\Core\Form\FormBuilder->doBuildForm('node_brand_edit...', Array, Object(Drupal\Core\Form\FormState)) #5 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(557): Drupal\Core\Form\FormBuilder->doBuildForm('node_brand_edit...', Array, Object(Drupal\Core\Form\FormState)) #6 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('node_brand_edit...', Array, Object(Drupal\Core\Form\FormState)) #7 /var/www/html/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('node_brand_edit...', Object(Drupal\Core\Form\FormState)) #8 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #9 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #10 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #11 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #12 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #13 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #14 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(139): call_user_func_array(Object(Closure), Array) #15 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(62): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #16 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(652): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #25 {main}.
Comments
Comment #2
marcoscanoI have tried to manually reproduce the failing scenario you mention, but I am unable to do it with the current -dev.
Could you please indicate if this issue still exists, and if so, provide steps to reproduce it?
Thanks!
Comment #3
stewest CreditAttribution: stewest at Amazee Labs commentedI get this too, D8.3.6 and Entity Browser 8.1.0 (about to try 8.1.1)
With a nested Paragraph in a Paragraph, which has an Entity browser on one of the image fields.
from: /node/add/page?_wrapper_format=drupal_ajax&_wrapper_format=drupal_ajax&ajax_form=1