Not possible to reuse field formatters between entity_reference, file, and image fields

Created on 14 September 2015, almost 9 years ago
Updated 19 February 2023, over 1 year ago

Problem/Motivation

If I create an entity reference field (not file field) that can reference files, I cannot use any file field formatters to output the referenced files. Similar situation for image field formatters. Or for using entity reference field formatters on file and image fields.

Contributed modules like https://www.drupal.org/project/file_image_formatters and https://www.drupal.org/project/file_entity_reference_image_formatter and https://www.drupal.org/project/entity_formatters . This is easily solvable from core.

Proposed resolution

Allow reuse between file, image, and entity_reference field formatters.

If a field extends another field, it should ensure that the parent field's formatters are available to it as well. And in the case of entity-specific reference fields that extend the entity_reference field type, the entity-specific formatter should be available to entity_reference if the target_type matches the specific entity type.

Remaining tasks

- Reroll for 10.1


- Review

User interface changes

- None (aside from additional formatters available in Field UI).

API changes

- None

Data model changes

- None

🐛 Bug report
Status

Needs work

Version

10.1

Component
File module 

Last updated 3 days ago

Created by

🇺🇸United States Dave Reid Nebraska 🇺🇸

Live updates comments and jobs are added and updated live.
  • Contributed project blocker

    It denotes an issue that prevents porting of a contributed project to the stable version of Drupal due to missing APIs, regressions, and so on.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024