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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

shaisamuel’s picture

Category: support » feature

This 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.

gmclelland’s picture

If 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?

ParisLiakos’s picture

Title: Exporting File Field Display (Manage Display) » Exporting File Field Display (Manage File Display)
Version: 7.x-2.0-unstable7 » 7.x-2.x-dev
joachim’s picture

Priority: Normal » Major

The 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.

Devin Carlson’s picture

Status: Active » Needs review
FileSize
426 bytes

You 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.

Devin Carlson’s picture

Status: Needs review » Fixed

Committed #5 to File entity 7.x-2.x.

Status: Fixed » Closed (fixed)

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

joelcollinsdc’s picture

Can someone else confirm that this works now? I still can't export the defualt file displays.

samhassell’s picture

I'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:

sam@ubuntu1204:~/www/gateway/docroot/sites/all/modules/features/seed_media (develop *$%)$ drush @gateway fd seed_media
  
Legend: 
Code:       drush features-revert will remove the overrides.
Overrides:  drush features-update will update the exported feature with the displayed overrides

Component: file_display
        'multiple_file_behavior' => 'tags',
      ),
<   ),
<   'audio__preview__file_field_file_default' => array(
<     'status' => FALSE,
    ),
    'audio__preview__file_field_file_download_link' => array(
        'origin' => '',
      ),
<   ),
<   'document__preview__file_field_file_default' => array(
<     'status' => FALSE,
    ),
    'document__preview__file_field_file_download_link' => array(
        'mobile_codes_preset' => 'block_node_url',
      ),
<   ),
<   'video__preview__file_field_file_default' => array(
<     'status' => FALSE,
    ),
    'video__preview__file_field_file_download_link' => array(
Danny_Joris’s picture

This is not working for me either. Still trying to figure out why. This stuff is quite complicated.

ericmulder1980’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha2

This 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

features[file_display][] = audio__preview__file_field_file_default

I add the following to the features .file_default_displays file

$file_display = new stdClass();
$file_display->api_version = 1;
$file_display->name = 'audio__preview__file_field_file_default';
$file_display->weight = 0;
$file_display->status = FALSE;
$file_display->settings = '';
$export['audio__preview__file_field_file_default'] = $file_display;

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.

alexkb’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

Re-opening bug.

alexkb’s picture

As 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.

alexkb’s picture

I'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".

stevector’s picture

Like 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."

saltednut’s picture

#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.

recrit’s picture

Status: Active » Needs review
FileSize
4.72 KB

The attached patch moves full displays defined in image_file_default_displays_alter() to an install hook.

Status: Needs review » Needs work

The last submitted patch, 17: file_entity-move-file-display-alter-to-db-1858370-17.patch, failed testing.

recrit’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Status: Needs work » Needs review
recrit’s picture

Status: Needs review » Needs work

The last submitted patch, 17: file_entity-move-file-display-alter-to-db-1858370-17.patch, failed testing.

The last submitted patch, 17: file_entity-move-file-display-alter-to-db-1858370-17.patch, failed testing.

mstef’s picture

#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.

SocialNicheGuru’s picture

conflicts with another patch: file_entity-move-file-display-alter-to-db-1858370-17.patch

mstef’s picture

May 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..

mstef’s picture

So, 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..

joelcollinsdc’s picture

Status: Needs work » Needs review

I'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?

brockfanning’s picture

The 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.

torotil’s picture

Status: Needs review » Needs work

Why 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.

recrit’s picture

Status: Needs work » Closed (duplicate)

Closing since #2192391: Default file entities are not exportable by features (Sibling Issue) appears to fix this issue with an install function for all.