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 am trying to find where I can export the customizations I have made to the field display of the default file entity types. I can export the 'File Display' information, but not the added fields or field display configuration (like I can for content types).
I have ctools and features installed.
Thank you.
Comment | File | Size | Author |
---|---|---|---|
#17 | file_entity-move-file-display-alter-to-db-1858370-17.patch | 4.72 KB | recrit |
#5 | implement-ctools-plugin-api-for-file-displays-1858370-5.patch | 426 bytes | Devin Carlson |
Comments
Comment #1
shaisamuel CreditAttribution: shaisamuel commentedThis is critical, if your are working by the book using dev/stage/prod.
I am using media: youtube, and try to export configuration (access using admin/structure/file-types/manage/video/file-display). I think its should be done in File_Entity.
Comment #2
gmclelland CreditAttribution: gmclelland commentedIf you are using http://drupal.org/project/entity_view_mode, you need to use the patch in #1425620: Features Module Support. You could also use the Display Suite with the Features module to export everything.
Is that what you are talking about?
Comment #3
ParisLiakos CreditAttribution: ParisLiakos commentedComment #4
joachim CreditAttribution: joachim commentedThe patch at #1425620: Features Module Support is completely unrelated to the functionality requested here.
Entity view modes module provides an admin UI for defining additional view modes for entities. It then declares these to Drupal with hook_entity_info_alter().
The UI-defined view modes are stored in a system variable, 'entity_view_modes'. The patch therefore is about exporting that variable to Features. Though that issue has some debate about whether it would be better to move over to having those view modes stored in a table (which I happen to agree with).
Meanwhile, File Entity module provides an admin UI for configuring a hard-coded (AFAICT) set of 6 view modes for file entities. The settings for these view modes appear to be stored in the {file_display} table -- though I can't yet tell exactly how -- it looks rather confusing at first glance.
Therefore, whatever a patch for Entity view modes does, it's never going to affect what this module does.
Comment #5
Devin Carlson CreditAttribution: Devin Carlson commentedYou can export the file field displays by using the ctools bulk export module (included with ctools) or by using the Features module. Unfortunately, exported file displays don't currently work as File entity doesn't implement the ctools plugin API for default file displays.
The attached patch adds the file_default_displays API to the list of plugin APIs implemented by File entity.
Comment #6
Devin Carlson CreditAttribution: Devin Carlson commentedCommitted #5 to File entity 7.x-2.x.
Comment #8
joelcollinsdc CreditAttribution: joelcollinsdc commentedCan someone else confirm that this works now? I still can't export the defualt file displays.
Comment #9
samhassell CreditAttribution: samhassell commentedI've still got the following file displays that won't export in features. I can select them, but after setting up the new export, they are still listed as exportable.
audio__preview__file_field_file_default
document__preview__file_field_file_default
video__preview__file_field_file_default
I've tried removing all the code related to file displays from the feature and re-adding it, but the same thing happens.
features diff:
Comment #10
Danny_Joris CreditAttribution: Danny_Joris commentedThis is not working for me either. Still trying to figure out why. This stuff is quite complicated.
Comment #11
ericmulder1980 CreditAttribution: ericmulder1980 commentedThis is still not working for me, the patch in #5 is applied in alpha2 but default view modes are not exported to features. After i manually add the configuration to the feature and recreate the feature my modifications are deleted.
Example
The feature interface (UI) mentions the following file display settings are missing
audio__preview__file_field_file_default
I add the following to the features .info file
I add the following to the features .file_default_displays file
At this point my feature no longer reports any overrides. Doing a feature update (drush fu) then deletes the modifications and my feature is overridden once again.
Same thing happens for document__preview__file_field_media_large_icon, image__preview__file_field_image and video__preview__file_field_file_default.
Comment #12
alexkb CreditAttribution: alexkb commentedRe-opening bug.
Comment #13
alexkb CreditAttribution: alexkb commentedAs a work around, we've tried update hooks to try set our file_entity file displays, but this causes other side affects and the feature remains overriden of course too.
It's difficult to work out where to debug this - whether it's a features module issue or file_entity. The exports of file_entity also relies on ctools to do some of its exporting (see the _ctools_plugin_api() addition in your .features.inc), so maybe the problem is with ctools too. Whatever the case, it seems a little strange that every file_display setting has its own file_entity item to check when exporting/creating the feature.
We're using the 2.0-alpha3 release. The latest commit to -dev, doesn't look like it would matter too much.
Comment #14
alexkb CreditAttribution: alexkb commentedI've been able to fix most of the overridden issues, by insuring all the file_displays that look overridden are actually included. The only one left that won't export is the image style of file_display "image__default__file_field_image".
Comment #15
stevectorLike Alexkb, my workaround has been to put all the machine names of file_display exportables into one feature. Well, all the machine names that show up in the diff (not the hundreds of potential file_display exportables that don't show up in the diff.)
Once they're all exported to the same feature I no longer get a misreport of "Overridden."
Comment #16
saltednut#14 & #15 confirmed here although I am able to add file_display:image__default__file_field_image to a Feature if I use drush. Many, if not all of the machine names that show overridden have no checkbox in the Features UI.
Why? I do not know.
Comment #17
recrit CreditAttribution: recrit commentedThe attached patch moves full displays defined in image_file_default_displays_alter() to an install hook.
Comment #19
recrit CreditAttribution: recrit commentedComment #20
recrit CreditAttribution: recrit commented17: file_entity-move-file-display-alter-to-db-1858370-17.patch queued for re-testing.
Comment #23
mstef CreditAttribution: mstef commented#17 isn't working for me. After exporting and installing the site clean, the feature is permanently overridden.
EDIT: The exported settings don't appear present when I look at the file display either.
Comment #24
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedconflicts with another patch: file_entity-move-file-display-alter-to-db-1858370-17.patch
Comment #25
mstef CreditAttribution: mstef commentedMay be able to disregard what I said in comment 23. I'm using Media Youtube and a patch on their queue seemed to fix the issue for me (without needing this patch): #1863788: File display settings not exported.
EDIT: Forget what I said (again). Still having the same issues..
Comment #26
mstef CreditAttribution: mstef commentedSo, using this patch, what I just figured out is that I needed to export a certain amount of (unwanted) file displays in order for the feature to not be overridden. Not really sure why..
Comment #27
joelcollinsdc CreditAttribution: joelcollinsdc commentedI'm testing on a clean install of drupal + features, file_entity, this seems to work great so far. What is the problem people have found with this patch? It doens't pass tests?
Comment #28
brockfanning CreditAttribution: brockfanning commentedThe patch works for me too. Is it the whitespace error that makes it fail testing? EDIT: Ah, just looked at the test results. Seems like a bunch of exceptions, all caused by the $export_type variable not being present.
Comment #29
torotil CreditAttribution: torotil commentedWhy don't we simply use hook_file_default_displays() as is? This should be good enough for most cases of default configuration.
Using hook_file_default_displays_alter() completely breaks features. While pushing stuff into the data-base just makes them overridden by default. Both is bad.
Comment #30
recrit CreditAttribution: recrit commentedClosing since #2192391: Default file entities are not exportable by features (Sibling Issue) appears to fix this issue with an install function for all.