When you add a new media type whilst Crop API is installed, you get this pesky error message:
Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 227 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
This is due to Crop API calling $bundle->id() in crop_form_media_bundle_form_alter() -- the bundle has not been created yet, so it has no ID. Therefore, NULL is passed into the entity storage system, where it wreaks minor, but annoying, havoc.
Proposed Resolution
Crop API should only try to alter the media bundle edit form, which guarantees that the bundle has been saved and has an ID.
Comments
Comment #2
phenaproximaHere is a screenshot of the error, and a patch that fixes it. Not sure what else this needs before it can be committed...?
Comment #3
phenaproximaComment #4
woprrr commentedLook good to me
Thank a lot @phenaproxima
During this review I have seen some changes needed for 8.4 !! I count on you for follow next patches :) AGAIN sorry for delay :O
This patch need to be deploy on 1.x and 2.x
Comment #5
phenaproximaShould we land this patch in the 8.x-1.x branch (Media Entity-compatible), then have a follow-up issue to port the same changes into 8.x-2.x? That might be the cleanest way to go...
Comment #6
woprrr commentedYes, you right at the beginin I will try to make all changes in that issue but I've found somes fixes and I have created #2918441: Make Crop API compatible with core Media to assume theses changes.
This patch does merged only in 1.x branch
Comment #8
phenaproximaThanks, @woprrr!