Media_entity module has been moved to core and renamed to Media in Drupal core 8.4.x-dev (see #2831274: Bring Media entity module to core as Media module for details).
DropzoneJS entity browser widget submodule, specifically DropzoneJS media entity widget (MediaEntityDropzoneJsEbWidget) does not support Media, since media entity type has been renamed from media_bundle to media_type as the module was moved to core. Hence
"Drupal\Component\Plugin\Exception\PluginNotFoundException: The "media_bundle" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 133 of ...\core\lib\Drupal\Core\Entity\EntityTypeManager.php)."
error presents itself when saving Entity browser containing this widget. The same error message was already reported in #2820183: The "media_bundle" entity type does not exist., but the cause was different.
New version should be created to allow eb_widget submodule support Media in Drupal core, while current version would continue to support media_entity module.
Comment | File | Size | Author |
---|---|---|---|
#21 | interdiff-2897255-18-21.txt | 2.9 KB | chr.fritsch |
#21 | 2897255-21.patch | 12.84 KB | chr.fritsch |
#18 | interdiff_2897255_18_16.txt | 5.35 KB | mtodor |
#18 | 2897255_18.patch | 12.99 KB | mtodor |
#16 | interdiff-2897255-5-16.txt | 1.01 KB | chr.fritsch |
Comments
Comment #2
peter.keppert CreditAttribution: peter.keppert commentedComment #3
marcoscanoComment #4
peter.keppert CreditAttribution: peter.keppert commentedComment #5
peter.keppert CreditAttribution: peter.keppert commentedComment #6
peter.keppert CreditAttribution: peter.keppert commentedPatch attached. Tested against Drupal 8.4.x and widget is correctly added to entity browser and entities can be uploaded via both "Media Entity DropzoneJS" and "Media Entity DropzoneJS with edit".
Please note that new version should be created and this patch should not be committed to 8.x-1.x , since it will break support for media_entity module. However anyone who wishes to test this widget with Drupal 8.4 and Media can do so by applying this patch in the meantime.
Comment #7
peter.keppert CreditAttribution: peter.keppert commentedComment #8
peter.keppert CreditAttribution: peter.keppert commentedComment #9
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedGreat work. Thanks. Haven't had time to test/check yet. It would be great if we got some more testing feedback too.
Regarding on how not to break support for contrib, I think other modules in the ecosystem created a new branch for that. We could probably do the same.
Comment #10
chr.fritschI tested it functional and it works quite well so far.
I have two suggestions:
Comment #11
mtodor CreditAttribution: mtodor at Thunder commentedI have adjusted few things, but I didn't test it extensively.
Comment #12
mtodor CreditAttribution: mtodor at Thunder commentedComment #13
chr.fritschThe update hook should live in eb_widget/dropzonejs_eb_widget.install
Comment #14
mtodor CreditAttribution: mtodor at Thunder commentedI have moved update hook to the submodule.
Comment #15
mtodor CreditAttribution: mtodor at Thunder commentedHopefully, uploading the patch file with all changes. :>
Comment #16
chr.fritschI checked the upgrade path and it worked fine.
Only thing that was not working was the type filtering on the config form. I removed that part, because it was an improvement of this patch.
We can do that in a proper way in a follow-up.
I would mark it as RTBC, but now i changed a bit.
Comment #17
Primsi CreditAttribution: Primsi at MD Systems GmbH for MD Systems GmbH commentedThere are a few other places where we could maybe do some renaming:
Another code style nitpick: camel case variables are only allowed for class members.
Apart from that looks good to me.
Comment #18
mtodor CreditAttribution: mtodor at Thunder commented@Primsi - I have uploaded a new patch with the renaming of variables.
And code that you have marked is correct since
media_entity_bundle
key is used for configuration by version 1.x and with 2.x we are renaming that key, then update hook has to migrate configuration from old key to new key. So, that's how it should work.Comment #19
mtodor CreditAttribution: mtodor at Thunder commentedComment #20
phenaproximaPatch looks good to me. All I found were nitpicks.
If we use the static (procedural) style of loading the entity browsers, this is not needed. If we decide to keep it, though, \Drupal::entityTypeManager() is preferable, and the type hint is not needed.
This type hint is not necessary; \Drupal::logger() documents the return type.
Supernit: Since this code is procedural, why not simply do EntityBrowser::loadMultiple(), to shave off a few lines?
Nit: Should be "unable to change configuration..."
Nit: You can also do $this->getType()->getSource()->getSourceFieldDefinition(), to keep the abstraction sealed :)
Nit: The !empty() check is not needed; loadMultiple() returns an empty array if there are no media types.
Comment #21
chr.fritschFixed all the nits except from 6. If we remove the !empty() check we can't provide a help message.
Comment #22
phenaproximaAlllll-righty then! Looks great. Thanks, @chr.fritsch!
Comment #23
chr.fritschThanks everyone. Committed, pushed and created a new branch.
Comment #25
amaria CreditAttribution: amaria commentedHmm, shouldn't the info file have entity_browser (>=8.x-2.x) as dependency? Right now it automatically gets version 1.x.