Link field title from entity/route
So, I've written a preprocess function to do this:

/**
 * Prepares variables for link fields.
 */
function mymoduleortheme_preprocess_field__link(&amp;$variables) {

  // If the link is a reference to an internal entity and there was no
  // link title provided by the content editor, then use the entity
  // label as the link text.
  $i = 0;
  foreach ($variables['element']['#items'] as &amp;$item) {
    if (empty($item-&gt;get('title')-&gt;getValue()) &amp;&amp; $item-&gt;getUrl()-&gt;isRouted()) {
      $parameters = $item-&gt;getUrl()-&gt;getRouteParameters();
      if (!empty($parameters)) {
        foreach($parameters as $entity_type =&gt; $id) {
          if ($entity = \Drupal::entityTypeManager()-&gt;getStorage($entity_type)-&gt;load($id)) {
            $variables['items'][$i]['content']['#title'] = $entity-&gt;label();
            break;
          }
        }
      }
    }
    $i++;
  }
}


This is working with both the standard Link field formatter as well as the "Separate link text and URL" formatter provided by Drupal 8 core.



My only doubt here is that I'm not sure how safe it is to assume getRouteParameters() will always be keyed with an entity type name and a value of the entity id.

Would appreciate your help to review and vet this. Thanks!