diff --git a/lightning_media.module b/lightning_media.module index 085f8fdce..9b68fc966 100644 --- a/lightning_media.module +++ b/lightning_media.module @@ -63,8 +63,10 @@ function lightning_media_field_widget_form_alter(array &$element, FormStateInter */ function lightning_media_field_widget_entity_browser_entity_reference_form_alter(array &$element, FormStateInterface $form_state, array $context) { // Move the remaining number of selections to the details summary. - $element['#description'] .= $element['current']['#prefix']; - unset($element['current']['#prefix']); + if (!empty($element['current']['#prefix'])) { + $element['#description'] .= $element['current']['#prefix']; + unset($element['current']['#prefix']); + } /** @var \Drupal\Core\Field\FieldItemListInterface $items */ $items = $context['items'];