With #1296268: Add Preview and Teaser view modes and #1051090: Revamp file view modes: migrate media_small to teaser, media_large to full, media_preview to preview; deprecate link & original applied. As I noted in http://drupal.org/node/1296268#comment-6282102 it's impossible to export file display settings for the Image display style for the preview, teaser, and full build modes. This is because default display style configuration is implemented in hook_file_default_displays()
which competes with the implementation of hook_file_default_displays from Features.
Rather than implementing these as defaults that can't be changed without using an alter hook, can these instead be setup on installation? That way they could be deleted, changed, and properly exported.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1702700-media_move_default_image_styles_to_db-8.patch | 3.87 KB | ParisLiakos |
#4 | 1702700.4-media-move-default-display-style-to-db.patch | 3.75 KB | mrfelton |
#1 | 1702700-media-move-default-display-style-to-db.patch | 4.15 KB | mrfelton |
Comments
Comment #1
mrfelton CreditAttribution: mrfelton commentedAttached is a patch that gets rid of the implementation of
hook_file_default_displays()
. It adds a step to the install hook that creates the default display style configurations in the database instead. It also adds an update hook that moves the default configs (if they have not been overridden already) to the database.This patch is a follow on from #1051090: Revamp file view modes: migrate media_small to teaser, media_large to full, media_preview to preview; deprecate link & original and that needs to be applied before this.
Comment #3
mrfelton CreditAttribution: mrfelton commentedTest failed because it relies on the other patch being applied first. Setting back to needs review.
Comment #4
mrfelton CreditAttribution: mrfelton commentedPatch updated against latest dev+#1051090: Revamp file view modes: migrate media_small to teaser, media_large to full, media_preview to preview; deprecate link & original
Comment #6
mrfelton CreditAttribution: mrfelton commentedyes - it did fail. same reason as before.
Comment #7
ParisLiakos CreditAttribution: ParisLiakos commentedNow that those commited #4: 1702700.4-media-move-default-display-style-to-db.patch queued for re-testing.
Comment #8
ParisLiakos CreditAttribution: ParisLiakos commentedApplied and tested manually, display settings are transferred succesfully and i can successfully export with features.
lets see what bots say before commiting
Comment #9
ParisLiakos CreditAttribution: ParisLiakos commentedadding to commit list
Comment #10
populist CreditAttribution: populist commentedI tested the patch in #8 and it works well to export the new image styles with features. It also properly sets the defaults using the hook_install() method.
However, there is a problem with the install hook when used in an installation profile. The problem is that media_install() sets the defaults into the database (using file_save_display) which means that any feature that featurizes these items is going to come in as overridden.
Not sure if to change this issue status, since the patch does do what it needs to do, but I think that "default" behavior here should be reworked and not set directly in hook_install(). For now, here is my workaround which just removes the defaults in my featured module:
Comment #11
ParisLiakos CreditAttribution: ParisLiakos commentedi see what you are saying
any insights on how should we do this?
Please open a new issue to discuss this, i committed this
Comment #13
Angry Dan CreditAttribution: Angry Dan commentedPlease feel free to correct me if I'm wrong, but don't we have exactly the same problem in the file_entity module?
Because over there we have file_entity_file_default_displays() and that does a similar thing, no?
Comment #14
Angry Dan CreditAttribution: Angry Dan commentedLMGTFY... #2192391: Default file entities are not exportable by features (Sibling Issue)