Problem/Motivation
The module linked_field supports adding a link around fields with the related field being selectable from link fields in the bundle that the display relates to.
There is some logic to find the bundle in hook_field_formatter_settings_summary_alter
$bundle = $field_definition->getTargetBundle();
if (!$bundle) {
$bundle = $form['#bundle'] ?? NULL;
}
This works with layout builder for image fields, but not for title fields (generic fields, fields shared across bundles?).
Steps to reproduce
Specific to linked_field, although this issue is related to the bundle information being passed to the hook generally
- install 'linked_field' composer require drupal/linked_field && drush en -y linked_field
- Create a link field on the content type.
- Edit a layout with layout builder. e.g. go to article.
- Place the title block in the layout
- Try to 'link this field'.
- result is 'no fields available'. The expected result is a select list with the link field listed.
The field settings form with an image
![Image lists the link field]()
Title does not
![Title has no fields to choose]()
Possibly similar issues - Create a link field on the content type.
Proposed resolution
it is impossible to check whether this issue happens when laying out fields without layout builder as you can't access title settings. The layout builder call stack seems to be called without 'Use Layout Builder' checked. Possibly the error is in 'Entity View'?
$plugin has the view_mode. Why not bundle?
- $field_definition has the bundle property set to null
- $form does not have a 'bundle' entry
![Field definition bundle is null]()
$view_mode is also passed to the hook
Better still implement the event FIELD_FORMATTER_SETTINGS_SUMMARY_ALTER
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet