Hi,

I tried to export the settings of the file display (type video > Youtube video > Default) on admin/structure/file-types/manage/video/file-display into a feature. However when I inspect the [feature].info file, I do not see it exported properly.

dependencies[] = ctools
dependencies[] = file_entity
features[ctools][] = file_entity:file_default_displays:1
features[features_api][] = api:1
features[file_display][] = video__default__file_field_file_default
features[file_display][] = video__default__file_field_file_rendered
features[file_display][] = video__default__file_field_file_table
features[file_display][] = video__default__file_field_file_url_plain
features[file_display][] = video__default__file_field_media_large_icon
features[file_display][] = video__default__file_image
features[file_display][] = video__preview__file_field_file_default
features[file_display][] = video__preview__file_field_file_rendered
features[file_display][] = video__preview__file_field_file_table
features[file_display][] = video__preview__file_field_file_url_plain
features[file_display][] = video__preview__file_field_media_large_icon
features[file_display][] = video__preview__file_image
features[file_display][] = video__preview__media_vimeo_video
features[file_display][] = video__preview__media_youtube_video
features[file_display][] = video__teaser__file_field_file_default
features[file_display][] = video__teaser__file_field_file_rendered
features[file_display][] = video__teaser__file_field_file_soundcloud
features[file_display][] = video__teaser__file_field_file_table
features[file_display][] = video__teaser__file_field_file_url_plain
features[file_display][] = video__teaser__file_field_media_large_icon
features[file_display][] = video__teaser__file_image

Is this a bug, or am I missing something?

Thanks a lot !
Maarten

Comments

msteurs’s picture

Well, having a better look at it, I think those settings are even not (yet) exportable, as they don't appear in the File Entity tab of the Feature Create page.

Thanks again, Maarten

joelcollinsdc’s picture

Same here. Strange though that they are visible from drush fc. Weird.

NEW view modes export perfectly. Teaser/preview/default don't. not sure if this is a file_entity issue or what. Since I can see the exportables via drush i'm guessing its how media_youtube has exported its defualts?

shaisamuel’s picture

This is such an important & critical feature, in today's Drupal style development. I dont know what is the effort to add, if I had the knowledge I would be happy to help.

aaron’s picture

Status: Active » Closed (duplicate)
james.williams’s picture

The file display settings can't be exported with Features because they are declared by media_youtube in a hook_file_default_displays() rather than just being written to the database. Only one module (features or otherwise) can declare a default display (or other features component), so Features doesn't allow another module to export them. The media: vimeo project has the same problem.

It's possible to implement hook_file_default_displays_alter() in your module's .module file to change the original default file display declaration to have the settings that you want, but this is more of an alternative approach to solving the problem than actually allowing the configuration to be exported normally into a feature.

mikgreen’s picture

Issue summary: View changes
StatusFileSize
new5 KB

Here is a patch that moves file display defaults to database.
After applying this, the settings are exportable with features.

Inspired by how media module does it: https://drupal.org/node/1702700

mikgreen’s picture

Status: Closed (duplicate) » Needs review

Reopening

mikgreen’s picture

StatusFileSize
new4.34 KB
recrit’s picture

Updates to the patch:
* Moved the import to a separate function.
* Added an update hook for existing installs.

marcelovani’s picture

Media Youtube's hook_display_alter was conflicting with Features/Features Override.
I have applied this patch and all works fine.
Thanks.

andrewhine’s picture

I have also applied this patch and can confirm it resolves the issue.

mstef’s picture

Patch working for me. Thanks.

rossb89’s picture

Patch in #9 confirmed working with previously exported to features - media youtube file display settings.

marcelovani’s picture

Status: Needs review » Reviewed & tested by the community
aaron’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

stefan.r’s picture

Thanks for this patch! What would need to happen in order to get a new release out with this patch? (rc5?)

torotil’s picture

Status: Closed (fixed) » Needs work

Why not simply use hook_file_default_displays() in the first place?

The current approach basically overrides any display settings of features. This breaks install profiles.

joelcollinsdc’s picture

Status: Needs work » Closed (fixed)

@torotil, Check the commit, thats exactly what this commit does.

torotil’s picture

Status: Closed (fixed) » Needs work

No it doesn't. The linked commit pushes the file_display settings into the database in hook_install() and hook_update().
It does not use hook_file_default_displays(). And as stated above that breaks installation profiles.

saltednut’s picture

Hmm.. regarding #18 "this breaks install profiles' -- that requires more specific info to be clear... but I know your install profile architecture must not duplicate what your features architecture does. I assume that is what is breaking. Maybe I am off base here... But we have been using these patches for both File Entity, Media and Media Youtube for some time and the install profile works fine, but we leave it up to Features to manage the default settings for these file_display settings. So the fact that some defaults get set on hook_install doesn't really matter as we just immediately override it with the Feature later on during the installation. The way we manage this is by adding some changes to our install profile so that all the profile's Features get reverted as the final action of installation.

You can't really have Features try to persist configuration if you're using a hook that also persists this configuration. They will always be opposed.

Unless we change how hook_file_default_displays() works, it will always override the Feature.

torotil’s picture

Unless we change how hook_file_default_displays() works, it will always override the Feature.

No, that's what module weights are for. Your feature simply needs to have a higher weight than media_youtube then it should be fine.

The way we manage this is by adding some changes to our install profile so that all the profile's Features get reverted as the final action of installation.

Exactly. You're adding an extra feature_revert in the installation profile because the feature itself is broken due to the way this issue was resolved.

  • Devin Carlson committed 8155712 on 7.x-2.x
    Revert "Issue #1863788 by mikgreen, recrit: File display settings not...
dgtlmoon’s picture

This seemed to work for me in current 2.x-dev, I could export the various display modes and they were reverted correctly, is that all there is to it?

jp.stacey’s picture

This issue is I think a subset of the more general issue #2104193: Default file entities are not exportable by features (Media File Entity Overridden). As that issue's further on, I think this one should be marked as a duplicate but I can't be 100% sure. Anyone stumbling across this should at least consider both issues!

basvredeling’s picture

Status: Needs work » Closed (duplicate)

@jp.stacey I think you're right. A generic solution would be preferable. Thanks for the crosstag. I'm being forward here and closing this in favor of #2104193: Default file entities are not exportable by features (Media File Entity Overridden).