Active
Project:
Drupal core
Version:
main
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Jul 2026 at 15:15 UTC
Updated:
6 Aug 2026 at 12:26 UTC
Jump to comment: Most recent
If an entity reference field is managed by a view and configured in autocomplete mode, an incomplete sentence is displayed.
File: web/core/modules/media/src/Hook/MediaHooks.php L208-216.
if ($is_autocomplete) {
$elements['#media_help']['#media_list_help'] = $this->t('Type part of the media name.');
$overview_url = Url::fromRoute('entity.media.collection');
if ($overview_url->access()) {
$elements['#media_help']['#media_list_link'] = $this->t('See the <a href=":list_url" target="_blank">media list</a> (opens a new window) to help locate media.', [':list_url' => $overview_url->toString()]);
}
$bundle_labels = array_intersect_key(\Drupal::service('entity_type.bundle.info')->getBundleLabels('media'), $allowed_bundles);
$elements['#media_help']['#allowed_types_help'] = $this->t('Allowed media types: %types', ['%types' => implode(", ", $bundle_labels)]);
}
The $bundle_labels variable is empty because a view is used. You can see the following sentence:
"Enter part of the media name. Consult the list of media (opens a new window) to help locate the media. Allowed media types: "
Add a check for the handler method, or verify that $bundle_labels is not empty.
Comments
Comment #2
quietone commentedHi, Issues for Drupal core should be targeted to the 'main' branch, our primary development branch. Changes are made on the main branch first, and are then back ported as needed according to the Core change policies. The version the problem was discovered on should be stated in the issue summary Problem/Motivation section. Thanks.