getEntityFieldStorageMetadata(): Argument #2 ($entity_field_map) must be of type array, null given

Created on 27 September 2024, 3 months ago

Problem/Motivation

I enabled ui patterns 2 on my site but get this error when I try to place a block

Backtrace
#0 /app/web/modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php(321): Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getEntityFieldStorageMetadata(Array, NULL, Array)
#1 /app/web/modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php(59): Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->getEntityFieldsMetadata()
#2 /app/web/modules/contrib/ui_patterns/src/Plugin/Derivative/EntityFieldSourceDeriverBase.php(66): Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase->__construct(Object(Drupal\Core\Entity\EntityFieldManager), Object(Drupal\Core\TypedData\TypedDataManager), Object(Drupal\Core\Entity\EntityTypeManager), Object(Drupal\Core\Entity\EntityTypeBundleInfo))
#3 /app/web/modules/contrib/ui_patterns/src/Plugin/Derivative/FieldPropertySourceDeriver.php(24): Drupal\ui_patterns\Plugin\Derivative\EntityFieldSourceDeriverBase::create(Object(Drupal\Core\DependencyInjection\Container), 'field_property')
#4 /app/web/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php(25): Drupal\ui_patterns\Plugin\Derivative\FieldPropertySourceDeriver::create(Object(Drupal\Core\DependencyInjection\Container), 'field_property')
#5 /app/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(99): Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator->getDeriver('field_property', Array)
#6 /app/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array)
#7 /app/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(337): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
#8 /app/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(213): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
#9 /app/web/core/lib/Drupal/Core/Plugin/Context/ContextAwarePluginManagerTrait.php(23): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#10 /app/web/modules/contrib/ui_patterns/src/SourcePluginManager.php(398): Drupal\ui_patterns\SourcePluginManager->getDefinitionsForContexts(Array)
#11 /app/web/modules/contrib/ui_patterns/src/SourcePluginManager.php(160): Drupal\ui_patterns\SourcePluginManager->getDefinitionsForContextsRefined(Array)
#12 /app/web/modules/contrib/ui_patterns/src/SourcePluginManager.php(128): Drupal\ui_patterns\SourcePluginManager->getNativeDefinitionsForPropType('variant', Array, Array)
#13 /app/web/modules/contrib/ui_patterns/src/Element/ComponentFormBase.php(163): Drupal\ui_patterns\SourcePluginManager->getDefinitionsForPropType('variant', Array, Array)
#14 /app/web/modules/contrib/ui_patterns/src/Element/ComponentPropForm.php(79): Drupal\ui_patterns\Element\ComponentFormBase::getSources('variant', Array, Array)
#15 [internal function]: Drupal\ui_patterns\Element\ComponentPropForm::buildForm(Array, Object(Drupal\Core\Form\FormState), Array)
#16 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(1006): call_user_func_array(Array, Array)
#17 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(1069): Drupal\Core\Form\FormBuilder->doBuildForm('block_form', Array, Object(Drupal\Core\Form\FormState))
#18 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(1069): Drupal\Core\Form\FormBuilder->doBuildForm('block_form', Array, Object(Drupal\Core\Form\FormState))
#19 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(1069): Drupal\Core\Form\FormBuilder->doBuildForm('block_form', Array, Object(Drupal\Core\Form\FormState))
#20 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(579): Drupal\Core\Form\FormBuilder->doBuildForm('block_form', Array, Object(Drupal\Core\Form\FormState))
#21 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('block_form', Array, Object(Drupal\Core\Form\FormState))
#22 /app/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\block\BlockForm), Object(Drupal\Core\Form\FormState))
#23 /app/web/core/modules/block/src/Controller/BlockAddController.php(27): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\block\Entity\Block))
#24 [internal function]: Drupal\block\Controller\BlockAddController->blockAddConfigureForm('ui_patterns:ui_...', 'ui_suite_daisyu...')
#25 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#26 /app/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#27 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#28 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#29 /app/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#30 /app/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#31 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 /app/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 /app/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#37 /app/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /app/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /app/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#41 {main}

Steps to reproduce

Proposed resolution

Quick patching EntityFieldSourceDeriverBase.php I got this to go away: not all entity types have an entry in what EntityFieldManager's getFieldMap() return

Remaining tasks

Write a proper patch

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

miiimooo Europe

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