Follow-up to #2831936: Add "File" MediaSource plugin
Problem/Motivation
From #2831936-158: Add "File" MediaSource plugin :
At the moment, media is marked experimental, obviously we're trying to make it stable before 8.4.0 is released (otherwise we'll probably have to remove it from the 8.4.x branch and immediately put it back into 8.5.x to try again).
To do that, we need to keep media self-contained, putting the config into standard (even though it's optional) undermines that self-containment.
Proposed resolution
From #2831936-158: Add "File" MediaSource plugin :
we should open a follow-up to add the configuration, or add it to media for now with a follow-up to move it to standard when media's ready to go stable. That's one extra issue/patch, but worth it to keep things in one place for me.
Remaining tasks
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | 2883813-27.patch | 14.95 KB | wim leers |
| #21 | interdiff-2883813-18-21.txt | 645 bytes | chr.fritsch |
| #21 | move_file_image_media-2883813-21.patch | 11.97 KB | chr.fritsch |
| #18 | interdiff-2883813-16-18.txt | 907 bytes | chr.fritsch |
| #18 | move_file_image_media-2883813-18.patch | 12 KB | chr.fritsch |
Comments
Comment #2
vijaycs85Comment #3
berdirFollow-ups shouldn't use the original issue as parent. It can't be a sub-task of closed issue. Not sure if there's a diferent parent we should use, maybe the ideas issue?
Actually, I would recommend to keep it/move it now to the install profile.
I think having the configuration in the install profile is better because having it in the module will interfere with existing install profiles like thunder, lightning and so on as they already have their own media types they provide, it's not easily possible for an install profile to prevent configuration from a module to be installed (all you can do is delete it in hook_install()). Pretty sure that they will want to keep their own media bundles/types as existing data would otherwise be very hard to convert.
Comment #4
phenaproximaComment #5
phenaproximaAs I explained in #2831936-169: Add "File" MediaSource plugin, but would like to reiterate here:
As of that patch, several Media tests are deleting the File media type in their setUp() method. This is because the default configuration is, at the time of this writing, packaged with Media module rather than an install profile. Once we move the configuration into Standard, we will be able to delete those lines in the tests' setUp() method, since the tests will then be running without any default configuration (as they were originally written to do).
Comment #6
vijaycs85Basically we need to revert the diff file from #2831936-169: Add "File" MediaSource plugin
Comment #7
wim leersThis is blocked on Media becoming stable.
Comment #8
seanbWe need to move the image config back as well. #2831937-70: Add "Image" MediaSource plugin
Comment #9
wim leers#8++
Comment #11
chr.fritschMedia is stable now, so we are able to un-postpone this, right?
Last week i tried to run Thunder with core media and it turned out, that we are having some problems when the config lives in the media module and not in the profile. We are providing our own media type image with some third_party_settings and using a different field name for the source field.
So things would be much easier, if we could move the config into the profile.
Comment #12
chr.fritschAs discussed with @xjm during media meeting, we will unpostpone this to discuss if we could do this. As @berdir mentioned in #3 having the config in the module, brings some problems for install profiles.
I would propose to move the entity displays, field config and media types into config/optional of the standard profile. In that way it will only be installed if someone enables media module. Same as current behavior. But it would make it much easier for distributions to ship their own config.
Comment #13
chr.fritschHere is a patch to my suggestions from #12. I also moved the field storage, because they are coupled so tight to the media types
Comment #15
berdirWe'll also need to revert the test changes from the other issue that originally moved it I guess.
But I'm very +1 to this, this would make it hard for existing install profiles to migrate from media to media_entity (and keep the media types the same for new and existing types).
We can not prevent config from being installed, best we could do is deleting them again in hook_install().
It also needs to happen before 8.4.0, afterwards it might be a BC break?
Comment #16
chr.fritschAll the tests should be fixed
Comment #17
berdirit's not necessary to duplicate the module list from the parent, just add the additional ones. Not sure I understand why media_test_type is required now for this test? Is it because we need a media type to exist? Why in some cases we create one through the API and in this case we rely on the test module?
Comment #18
chr.fritschOk, i changed it to use the API for a media type creation. We are relying just once on the media_test_type now. When we are testing the creation from default configuration.
Comment #19
berdirThanks, looks good to me as I mentioned, this would be quite important for install profiles to get in before 8.4.0.
Comment #20
chr.fritschThis doesn't work for an image source. The type must be fetched from the source field before somehow
Comment #21
chr.fritschI just removed the type, so the WidgetPluginManager will handle it.
Comment #22
berdirWhat exactly was the problem and why didn't tests fail?
Comment #23
berdirWe might get some test fails due to #2835767: Media + REST: comprehensive test coverage for Media + MediaType entity types, re-testing..
Comment #25
chr.fritschRegarding #22: createMediaType() can be used to create media types from different sources. Having 'type' => 'file_generic' would only work, if the source field is a file field.
I changed the field name from field_media_file_1 to field_media_file in the new tests of #2835767: Media + REST: comprehensive test coverage for Media + MediaType entity types
Comment #26
wim leersYay, this patch is making the test coverage added by #2835767: Media + REST: comprehensive test coverage for Media + MediaType entity types more elegant — it addresses @effulgentsia's feedback at #2835767-70: Media + REST: comprehensive test coverage for Media + MediaType entity types and #2835767-73: Media + REST: comprehensive test coverage for Media + MediaType entity types.
Which means that for this patch to pass tests, it needs to make tiny modifications to the test coverage introduced by #2835767.
Comment #27
wim leers#25 and #26 are cross-posts. The solution in #25 is incomplete.
In this patch, I'm also importing the other changes #25 made.
Comment #28
wim leersComment #30
catchI think this would still be OK to commit during rc, but otherwise would need to wait until 8.5.x.
The only way I can see this being an actual bc break is if someone's relying on the default configuration existing, then it doesn't, but we don't offer any guarantee that default config exists. Is there any other implication I missed?
Comment #31
wim leersI think you're right, @catch.
Also, from
#drupal-mediaon IRC:Comment #32
phenaproximaSlam-dunk.
Comment #33
gábor hojtsyYay, I am so happy to see this go in. Very excited for where this leads media in 8.5 :)