Change record status: 
Project: 
Introduced in branch: 
11.4.x
Introduced in version: 
11.4.0
Description: 

A new resolvable_uri property is added to the link field which can be used in href attribute.

For example if an entity has a field_link and link field has following value:

  $entity->field_link = [
    'uri' => 'internal:/',
    'title'=> 'Home',
    'options' => [
      'fragment' => '#main-content',
    ],
  ];

Link field output in JSON:API would be in following format:
Before

"field_link": [
  {
    "uri": "internal:/",
    "title": "Home",
    "options": [
      'fragment' : '#main-content'
    ]
  }
]

This isn't very useful for anything consuming the API because it needs to process these links.
After

"field_link": [
  {
    "uri": "internal:/",
    "resolvable_uri": "/#main-content"
    "title": "Home",
    "options": [
      'fragment' : '#main-content'
    ]
  }
]

Now resolvable_uri property can be used in in href attribute.

Due to this change, a new token for link field would exist [entity:field_link:resolvable_uri].

API Addition
Similarly, if a resolvable_uri property is properly set it will initialize all the link property e.g.:

  $entity->field_link->resolvable_uri = 'https://www.drupal.org?test_param=test_value#main-content';

Same as:

   $entity->field_link->uri = 'https://www.drupal.org'
   $entity->field_link->options = [
     'query' => [
       'test_param' => 'test_value',
     ],
     'fragment' => '#main-content',
   ];
Impacts: 
Module developers
Themers
Site templates, recipes and distribution developers