diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php index f0bb021..3ca2b00 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php +++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/DefaultSelection.php @@ -147,18 +147,19 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta } // Process this list so it can be used in a select, showing one label - // and the machine name for each field. + // and the machine name for each field. Also cast to string so the list + // can be sorted. $options = []; foreach ($fields as $machine_name => $list) { $list = array_unique($list); if (count($list) > 1 ) { - $options[$machine_name] = $this->t('@label|... (@machine_name)', [ + $options[$machine_name] = (string) $this->t('@label|... [@machine_name]', [ '@label' => array_pop($list), '@machine_name' => $machine_name, ]); } else { - $options[$machine_name] = $this->t('@label (@machine_name)', [ + $options[$machine_name] = (string) $this->t('@label [@machine_name]', [ '@label' => array_pop($list), '@machine_name' => $machine_name, ]);