Problem/Motivation
I want to reference the crm contacts from another content type, as it is usually done in Drupal.
Steps to reproduce
In any content type I create a reference field, Select "Other" as the reference type, then Next. In the next screen, I select Contact as "Type of item to reference".
The following errors appear in the Log:
1. A Warning
Warning: Undefined array key "base_plugin_label" in Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->fieldSettingsForm() (line 456 of /var/www/html/public_html/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php)
#0 /var/www/html/public_html/core/includes/bootstrap.inc(104): _drupal_error_handler_real()
#1 /var/www/html/public_html/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php(456): _drupal_error_handler()
#2 /var/www/html/public_html/core/modules/field_ui/src/Form/FieldConfigEditForm.php(188): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->fieldSettingsForm()
#3 /var/www/html/public_html/core/lib/Drupal/Core/Entity/EntityForm.php(108): Drupal\field_ui\Form\FieldConfigEditForm->form()
#4 [internal function]: Drupal\Core\Entity\EntityForm->buildForm()
#5 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(554): call_user_func_array()
#6 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(396): Drupal\Core\Form\FormBuilder->retrieveForm()
#7 /var/www/html/public_html/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(163): Drupal\Core\Form\FormBuilder->rebuildForm()
#8 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(651): Drupal\autosave_form\Form\AutosaveFormBuilder->rebuildForm()
#9 /var/www/html/public_html/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(145): Drupal\Core\Form\FormBuilder->processForm()
#10 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(347): Drupal\autosave_form\Form\AutosaveFormBuilder->processForm()
#11 /var/www/html/public_html/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(98): Drupal\Core\Form\FormBuilder->buildForm()
#12 /var/www/html/public_html/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm()
#13 /var/www/html/public_html/core/modules/field_ui/src/Controller/FieldConfigAddController.php(62): Drupal\Core\Entity\EntityFormBuilder->getForm()
#14 [internal function]: Drupal\field_ui\Controller\FieldConfigAddController->fieldConfigAddConfigureForm()
#15 /var/www/html/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#16 /var/www/html/public_html/core/lib/Drupal/Core/Render/Renderer.php(634): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}()
#17 [internal function]: Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()
#18 /var/www/html/public_html/core/lib/Drupal/Core/Render/Renderer.php(649): Fiber->resume()
#19 /var/www/html/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#20 /var/www/html/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#21 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}()
#22 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#23 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#24 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#25 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#26 /var/www/html/public_html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#27 /var/www/html/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(118): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#28 /var/www/html/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(92): Drupal\page_cache\StackMiddleware\PageCache->pass()
#29 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#30 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#31 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#32 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(54): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#33 /var/www/html/public_html/core/lib/Drupal/Core/DrupalKernel.php(745): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#34 /var/www/html/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
#35 {main}
.
2. An Error
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/public_html/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php on line 456 in Drupal\Component\Utility\Html::escape() (line 433 of /var/www/html/public_html/core/lib/Drupal/Component/Utility/Html.php).
#0 /var/www/html/public_html/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php(456): Drupal\Component\Utility\Html::escape()
#1 /var/www/html/public_html/core/modules/field_ui/src/Form/FieldConfigEditForm.php(188): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->fieldSettingsForm()
#2 /var/www/html/public_html/core/lib/Drupal/Core/Entity/EntityForm.php(108): Drupal\field_ui\Form\FieldConfigEditForm->form()
#3 [internal function]: Drupal\Core\Entity\EntityForm->buildForm()
#4 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(554): call_user_func_array()
#5 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(396): Drupal\Core\Form\FormBuilder->retrieveForm()
#6 /var/www/html/public_html/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(163): Drupal\Core\Form\FormBuilder->rebuildForm()
#7 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(651): Drupal\autosave_form\Form\AutosaveFormBuilder->rebuildForm()
#8 /var/www/html/public_html/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(145): Drupal\Core\Form\FormBuilder->processForm()
#9 /var/www/html/public_html/core/lib/Drupal/Core/Form/FormBuilder.php(347): Drupal\autosave_form\Form\AutosaveFormBuilder->processForm()
#10 /var/www/html/public_html/modules/contrib/autosave_form/src/Form/AutosaveFormBuilder.php(98): Drupal\Core\Form\FormBuilder->buildForm()
#11 /var/www/html/public_html/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm()
#12 /var/www/html/public_html/core/modules/field_ui/src/Controller/FieldConfigAddController.php(62): Drupal\Core\Entity\EntityFormBuilder->getForm()
#13 [internal function]: Drupal\field_ui\Controller\FieldConfigAddController->fieldConfigAddConfigureForm()
#14 /var/www/html/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#15 /var/www/html/public_html/core/lib/Drupal/Core/Render/Renderer.php(634): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}()
#16 [internal function]: Drupal\Core\Render\Renderer::{closure:Drupal\Core\Render\Renderer::executeInRenderContext():634}()
#17 /var/www/html/public_html/core/lib/Drupal/Core/Render/Renderer.php(649): Fiber->resume()
#18 /var/www/html/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#19 /var/www/html/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#20 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber::onController():96}()
#21 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#22 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#23 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#24 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#25 /var/www/html/public_html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#26 /var/www/html/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(118): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#27 /var/www/html/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(92): Drupal\page_cache\StackMiddleware\PageCache->pass()
#28 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
#29 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#30 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(53): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#31 /var/www/html/public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(54): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#32 /var/www/html/public_html/core/lib/Drupal/Core/DrupalKernel.php(745): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#33 /var/www/html/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
#34 {main}
The same error appear when I Try out a demonstration using the simplytest.me in the project page.
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | Screenshot 2026-05-13 at 13-03-23 Manage fields SPRAT.png | 34.65 KB | mortona2k |
| #7 | Screenshot 2026-05-13 at 12-53-35 Manage fields SPRAT.png | 30.63 KB | mortona2k |
Issue fork crm-3588470
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tommynin commentedAfter 1 hour working with Claude and Gemini, there is the propositions for the fix:
Eureka! We have finally caught the "Ghost in the Machine."
The error occurs because Drupal 11's UI expects every selection "Group" to have a human-readable name. When you created (or the module provided) the ValidContactsSelection plugin with the group 'valid_contacts', the system looked for a label for that group, found null, and crashed when trying to sanitize it for the dropdown menu.
Here is how to fix this so you can get back to work.
Option 1: The "Fast Fix" (Recommended)
The simplest way to stop the crash is to move this plugin into the 'default' group. This just means it will appear under the standard "Default" category in the settings dropdown instead of a custom "Valid Contacts" category.
Open src/Plugin/EntityReferenceSelection/ValidContactsSelection.php.
Update the Attribute block to change the group:
PHP
#[EntityReferenceSelection(
id: 'valid_contacts:crm_contact',
label: new TranslatableMarkup('Valid Contacts: CRM Contact'),
entity_types: ['crm_contact'],
group: 'default', // <--- Change this from 'valid_contacts' to 'default'
weight: 10, // Increased weight so it appears after the standard selection
)]
Clear Caches: Run drush cr.
The field settings page should now load perfectly.
Option 2: The "Proper Fix" (If you want the custom group)
If you specifically want a separate category in the dropdown menu for "Valid Contacts," you have to tell Drupal what that group is called. You do this by implementing hook_selection_group_info_alter() in a custom module (or the crm.module file itself).
Add this code to your .module file:
PHP
/**
* Implements hook_selection_group_info_alter().
*/
function your_module_name_selection_group_info_alter(array &$groups): void {
$groups['valid_contacts'] = [
'label' => t('Valid Contacts'), // This provides the missing string
'weight' => 0,
];
}
I used the Fast Fix and it worked.
If the fix is ok, can you add it to the module code?
Comment #3
bluegeek9 commentedComment #4
bluegeek9 commentedComment #6
bluegeek9 commentedComment #7
mortona2k commentedI stumbled into this issue literally 7 minutes after you marked as needs review.
Before:

After:

Comment #8
mortona2k commentedCode change is minimal, works for me, and tests are passing.
The reference field type is still under Other, and not a standalone selection. Not sure if moving it would be helpful, but I think that is what is mentioned in option 2 in comment #2.
I think this is good to go, but will kick the tires a bit more today.
Comment #9
mortona2k commentedWorking well so far.