Problem/Motivation

For a node view, a field reference with format `Link label to the referenced entity` will have null #title and fail on builder and preview islands:

"Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Core/Utility/LinkGenerator.php on line 203"

When debugging we see #title of the link on the render array is null

Steps to reproduce

Create a node display, for example articles on profile standard:

  • Add Field tags with config:
  • Field: Tags
  • Formatter: Label
  • Check Link label to the referenced entity

Uncheck `Link label to the referenced entity` and it's ok.

Debugging the render array, we have:

[
  "#entity" => Drupal\taxonomy\Entity\Term
  "#type" => "link"
  "#title" => null
  "#url" => Drupal\Core\Url
  "#options" => [...]
  "#cache" => [...]
]

Seems in UI Patterns ComponentElementBuilder::buildSource()
The getValue return the '#title' => null.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

mogtofu33 created an issue.