Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I like the simplicity of this module. With just 154 lines of code it lets us use all image formatters for files and all file formatters for images. I think it is brilliant.
I was planning on something similar for Drupal8 and I see that we can't follow the same approach as field formatters are now generated using Plugins. Is there a way we can use the same approach for Drupal8 as well so that we can interuse the field formatters?
If you can provide some inputs, I will be happy to spend some time working on porting this to Drupal 8.
Comments
Comment #2
Dave ReidI would love to see if we could actually solve this in core first. I've filed bug reports that formatters can not be re-used in #2568289: Not possible to reuse field formatters between entity_reference, file, and image fields and #2568297: Not possible to use any image field formatters for entity reference fields that reference files.
Comment #3
gokulnk CreditAttribution: gokulnk at Azri Solutions for CyberSafe commentedAgree with you that it should be a part of the core. Since it was not part of core(I assumed that it was not included on purpose), I wrote a module https://www.drupal.org/project/file_entity_reference_image_formatter which helps format the file references as images.