Supporting Entity Browser when embedding media assets in a WYSIWYG editor was a big win for Lightning. But we can go even further. Lightning should provide an entity browser for all file types, starting with images. And image fields should use it by default. Each browser would have a library tab (a configurable view with a grid of previously uploaded images) and an upload widget for adding new images on the fly. These browsers would be displayed anywhere image fields are found, though it would of course be configurable on a case-by-case basis.
This functionality has been requested by many people for a long time. And all of it, I'm pleased to say, is finally ready for review in the 8.x-image-browser branch.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2767213-10.patch | 87.81 KB | balsama |
#5 | 2767213-5.diff | 71.29 KB | balsama |
Comments
Comment #2
phenaproximaComment #3
balsamaDiscussed this with phenaproxima offline. In addition to bugs and feature requests, I think there are also some architectural changes we'd like to make.
Comment #4
phenaproximaI have completely revamped this -- it's a lot leaner now, and doesn't have a dependency on File Entity (phew!) because it's able to take advantage of improvements in Entity Browser's API. Ready for review in the 8.x-image-browser branch.
Comment #5
balsamaAttaching patch from GH branch for testing.
Comment #6
balsamaGetting a fatal when I try to edit/add a node with an image field. Steps to reproduce are below, but I haven't tried to isolate which of these are/aren't related.
I get the following fatal:
PHP Fatal error: Call to a member function getDisplay() on a non-object in /Users/adam.balsam/Sites/lightning/build/docroot/profiles/lightning/modules/contrib/entity_browser/src/Element/EntityBrowserElement.php on line 76
Comment #7
phenaproximaYou need to run drush updb after rebuilding the code base from the 8.x-image-browser branch -- there is an update path :)
Comment #8
balsamaDoh!
So just two small things.
Once those are addressed, I think this is ready to merge.
Comment #9
phenaproximaI've fixed the PHP notice, but the alt text is a limitation in Entity Browser's API, so I've marked it as a known issue in our README. Entity Browser's maintainers might be open to extending the API so that we can address the alt text issue, but that won't be fixable in this branch.
Comment #10
balsamaUpdated patch.
Comment #11
balsamaCommitted. This is a big patch and will only apply to the previous commit. If you want to experiment with this feature, you'll need to pull the dev version of Lightning.
Comment #14
TravisCarden CreditAttribution: TravisCarden at Acquia commentedFYI, Re #8: Hide the unused "Alternative text" field on image media widget forms by TravisCarden · Pull Request #241 · acquia/lightning.
Comment #15
ec-adam CreditAttribution: ec-adam commentedLove the image browser use with image fields!
Two questions:
1) Is there any way to edit existing media inserted into the field at the field level (like an edit button to the image file)?
2) Is there any way to show fields from the image media bundle through the image field? I've got a setup use the entity image browser in the form display and the default image display. I've got a custom caption text field on the image that I want to show under the displayed image. I have not found any twig options or preprocess field setup that would let me find fields from the entity bundle.
Comment #16
phenaproximaNope! That is not a feature of Entity Browser's support for image fields, so Lightning does have support for that either.
Nope, sorry :( Again, this is a limitation of Entity Browser itself; Lightning doesn't push the envelope too far beyond what Entity Browser supports already. It may be possible to get some of these things happening with a custom module or theming magic, but it's not out of the box.