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 needed to set up a custom "view mode" for one of my field collections, this was possible in the current entity display settings page. Unfortunately there was no way to link up the field collection view mode and the field formatter on the node display settings.
I wrote a small module which creates a new field formatter for Field Collection fields, and pulls in all of the available view modes from the field collection settings.
I believe it would be beneficial to merge this module in with the field collection module itself. In the mean time this module is tested and working.
Comment | File | Size | Author |
---|---|---|---|
#2 | view_mode_selection-1324328-2.patch | 3.04 KB | stevector |
#1 | view_mode_selection-1324328-1.patch | 2.28 KB | stevector |
field_collection_view_modes.tgz | 939 bytes | nicksanta |
Comments
Comment #1
stevectorHere's a patch to the module.
Comment #2
stevectorThat patch didn't include any changes to field_collection_field_formatter_settings_summary()
Comment #3
arbel CreditAttribution: arbel commented+1 to this, tried the module and works great, but I too feel like it should be part of field collection
Comment #4
JohnAlbinYeah, I was wondering how the field_collection view mode hooked up to the view mode used by the parent entity.
Comment #5
JohnAlbinI tested this patch by applying it, adding a new "teaser" view mode using the Entity view modes module and configuring a different display for the field collection's "teaser" view mode.
Then I set the collection field on my node was configured "full display" view mode and confirmed it looked as it always did. Then I set the collection field on my node to use the "teaser" view mode and confirmed the field's display was using the "teaser" view mode's settings for the fields in the collection.
Sweet!
Comment #6
tim.plunketthttp://drupalcode.org/project/field_collection.git/commit/d9e0c85
Awesome, so glad this is working.