- Issue created by @thomas.frobieter
- 🇩🇪Germany Grevil
I will have a deeper look. This is caused by how the apllicable formatters are loaded. For each formatter "isApplicable()" is called, but both the Vidstack and Video formatter are extending the core "FileMediaFormatterBase". And their implementation of "isApplicable" fails, because the doesn't apply here, because the "FieldFormatterWithInlineSettings" field definition "file_extensions" setting doesn't include the media mime type.
- 🇩🇪Germany Grevil
Ok, I found the issue.
Instead of using the actual "real" field defintion of the referenced entity, we create a new one from the given storage definition here.
In the case of the file field, this will lead to "$field_definition->getSetting('file_extensions')" having the default value: "txt", instead of the actual "mp4" value. This in turn, leads to "isApplicable" returning false and the formatter not being displayed.
- Merge request !18Issue #3508059: Field formatter with inline settings is missing field formatters from the referenced (media) entity type → (Open) created by Grevil
- 🇩🇪Germany Grevil
This should do the trick. Now we are getting the "real" field definition, instead of creating one.
- 🇩🇪Germany Grevil
This issue also fixes 🐛 Field formatter with inline settings does not provide third_party_settings form of target field Needs work .
- Status changed to Needs review
2 months ago 7:53pm 11 July 2025 I've applied MR18 on my local as i need a fix for 🐛 Field formatter with inline settings does not provide third_party_settings form of target field Needs work , but i'm getting the folowing warnings on the config form:
Warning: Undefined array key "target_bundles" in Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings->settingsForm() (line 208 of modules/contrib/field_formatter/src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php). Warning: foreach() argument must be of type array|object, null given in Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings->settingsForm() (line 212 of modules/contrib/field_formatter/src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php).
For context purposes, i'm using the formatter on a custom entity type w/o bundles. Looks like that case on not handled by the MR, the $fieldDefinition variable remains NULL if there are no `targetEntityBundleIds` entries.
Core's `Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection::defaultConfiguration()` comment on `target_bundles` (defaults to NULL) says:// For the 'target_bundles' setting, a NULL value is equivalent to "allow // entities from any bundle to be referenced" and an empty array value is // equivalent to "no entities from any bundle can be referenced".