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

Created on 14 September 2015, about 9 years ago
Updated 19 August 2024, 3 months 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

11.0 🔥

Component
File module 

Last updated about 5 hours ago

Created by

🇺🇸United States dave reid Nebraska USA

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.71.5 2024