Fix array_merge for empty bundles in field storage data in Derive for each property

Created on 3 November 2024, 20 days ago

Problem/Motivation

TypeError: array_merge(): Argument #1 must be of type array, null given in array_merge() (line 440 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).

Steps to reproduce

When switching view mode in manage display
And change layout for the view mode to a component
Then I hit the following error

The website encountered an unexpected error. Try again later.

TypeError: array_merge(): Argument #1 must be of type array, null given in array_merge() (line 440 of modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php).
Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getDerivativeDefinitionsForEntityFieldStorages() (Line: 475)
Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getDerivativeDefinitions() (Line: 101)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives() (Line: 87)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 337)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 213)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 23)
Drupal\ui_patterns\SourcePluginManager->getDefinitionsForContexts() (Line: 61)
Drupal\ui_patterns\SourcePluginManager->getDefinitionsMatchingContexts() (Line: 43)
Drupal\ui_patterns\SourcePluginManager->getDefinitionsMatchingContextsAndTags() (Line: 154)
Drupal\ui_patterns\SourcePluginManager->getNativeDefinitionsForPropType() (Line: 122)
Drupal\ui_patterns\SourcePluginManager->getDefinitionsForPropType() (Line: 163)
Drupal\ui_patterns\Element\ComponentFormBase::getSources() (Line: 154)
Drupal\ui_patterns\Element\ComponentSlotForm::getSourceOptions() (Line: 305)
Drupal\ui_patterns\Element\ComponentSlotForm::buildSourceSelector() (Line: 143)
Drupal\ui_patterns\Element\ComponentSlotForm::buildForm()
call_user_func_array() (Line: 1006)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1069)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1069)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1069)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 1069)
Drupal\Core\Form\FormBuilder->doBuildForm() (Line: 579)
Drupal\Core\Form\FormBuilder->processForm() (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 54)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇯🇴Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024