Problem/Motivation

Entity browser itself provides "Upload" plugin that operates with files. It would be great to have an upload plugin that would work with media entity.

Proposed resolution

Extend original "upload" plugin to work with media entity images.

Let's think how to use dropzone.js or jquery file upload with this EB widget (and uploads in general).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slashrsm’s picture

Issue summary: View changes
slashrsm’s picture

Issue tags: -sprint +D8Media
DeFr’s picture

Version: » 8.x-1.x-dev
Assigned: Unassigned » DeFr

Note: An embed plugin got added in July. That being said, it's laking most of the configuration options in the Entity Browser creation UI, which makes it a bit hard to use.

Working on fixing that as a first step, so assigning myself. Patch coming up soonish.

DeFr’s picture

Assigned: DeFr » Unassigned
Status: Active » Needs review
FileSize
3.26 KB

Had to take an unexpected break, so it took a bit longer than planned, but here it is.

I'm still wondering about a few things in this patch though:

  1. Not sure about what would be best in case 0 ; current action match Entity Browser "your view is incorrectly configured, go fix it" behavior, and makes the site builder next step obvious, but I'm not sure having them lose the configuration of the entity browser in the process might not be ideal.
  2. Left the current "upload path" configuration in place ; not sure that's a good idea though, defaulting to the path set in the source field is probably better for most workflow

Thought about those two points more than welcome.

(Sidenote: also converted two remaining t() call to $this->t() , thought it wasn't worth it's own dedicated issue, but can be split if you want)

DeFr’s picture

FileSize
3.21 KB

Looks like it was late on Friday, not sure how I missed the fact that the source field type was a property of the media bundle… Replaced the loadMultiple by a loadByProperties, which will avoid loading bundles unnecessarily.

Also thought a bit more about the first point during the week-end, and maybe the correct fix would be to expand EntityBrowser WidgetInterface slightly, adding a method to check if a specific plugin should be available or not in the list based on the current site configuration. The View widget could use it to hide itself if there's no view with an entity_browser_display available, and ME image upload plugin could hide itself if there's no image bundle.

  • slashrsm committed 138e403 on 8.x-1.x authored by DeFr
    Issue #2512720 by DeFr, slashrsm: Create entity browser upload plugin...
slashrsm’s picture

Status: Needs review » Fixed

Committed. Added comment block above the function along the way.

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.