The integration with the Entity Browser is great for cases where there is a large amount of possible content to be embedded, and the challenging for the end-user is to find the right content. For cases where re-using content is sometimes useful but most assets are uploaded to be embedded only once, it would be great to be able to build on top of the widget provided by Inline Entity Form.

This would allow content authors to:

  • click on a button, which opens a modal
  • choose between creating a new entity or choose an existing one
  • when creating a new entity, create it within the modal window
  • save and embed

It would be great to achieve this via field widgets re-use. That sounds like a hard problem and that's why I suggest to create direct integration first and switch to file widgets re-use when we solve that.

Proposed resolution

Provide direct integration with EB.

Remaining tasks

PR from #10 needs some more work:
- clean-up (see comments on pull request)
- Automatically submit select step after EB has propagated it's selection
- Handle removal and new selection: currently selected entity is not displayed on the first step ATM. Instead of that we display entity browser. We need to display currently selected entity somehow and hide entity browser. If user wants to replace the entity we need to allow removal, which then triggers display of entity browser again

User interface changes

This two screenshots use entity browser that is provided by file_browser:

Files can be uploaded using DropzoneJS Entity browser widget or

selected from a view of existing images.

CommentFileSizeAuthor
#19 ee_eb_listing.png1.37 MBslashrsm
#19 ee_eb_dropzone.png266.14 KBslashrsm
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slashrsm’s picture

There is already basic IEF integration for Entity browser, which could be used once we integrate EB with entity_embed.

Providing support for field widgets in general is also something we already discussed in the past (and decided to implement it at some point).

Dave Reid’s picture

Title: Integrate with Inline Entity Form » Integrate with Entity Browser for selection
Category: Feature request » Task
Status: Needs work » Postponed

This is the workflow that will happen when we can integrate with the Entity Browser module for selection. Seeing as we don't have an existing issue for that task, I'm repurposing this one for that.

Dave Reid’s picture

I think we have a plan to make this possible with #2580703: [PP-1] Allow choice of entity reference field widget to be used for selection that doesn't require Entity Browser to be ready. Like re-using field formatters, let's make it possible to re-use any single field widget for selection in the Entity Embed modal.

slashrsm’s picture

Status: Postponed » Active

I am working on this.

slashrsm’s picture

Issue tags: +Media Initiative, +D8Media
Dave Reid’s picture

Status: Active » Closed (duplicate)

@slashrsm: With the new direction in #2580703: [PP-1] Allow choice of entity reference field widget to be used for selection we shouldn't need explicit integration at all. As long as Entity Browser is available as a Field Widget, it will "just work."

slashrsm’s picture

Status: Closed (duplicate) » Active

Has there been any work done on #2580703: [PP-1] Allow choice of entity reference field widget to be used for selection yet? Field widgets have a lot of dependencies on fields, parent entity, ... I am not saying it is impossible to do it, but it will require a lot of funky hacking IMO. Taking that into consideration it seems like something that could take a lot of time to implement.

EB integration, on the other hand, is something that can be done in a day. I already have working code, it just needs some clean-up.

With D8 around the corner and people asking for solutions we need to be pragmatic. Our priority must be delivering features now even if they are not the best possible. Take #2613520: Best approach while media entity is being developed ? for example:

There is a feeling of deja vu, quite the same loophole than D7 media when we had an -unstable3 release for over a year and a bunch of module to install and fingercrossed everything will work together or D6 imagefield vs image

Preventing D7 situation should be our main priority right now. We need to roll recommended releases of main modules by the end of this year and in order to achieve that we need to be pragmatic.

I will continue working on this. When #2580703: [PP-1] Allow choice of entity reference field widget to be used for selection gets in I'll be happy to remove/deprecate it.

Dave Reid’s picture

We've already handled a lot of that heavy work with using formatters, we should be able to re-use the same to make field widgets work.

slashrsm’s picture

Widgets are much more complex than formatters IMO. Formatters generate some HTML and that's it. With widgets, however, you need to handle all funky things that field widgets do in their forms. I'd really like to see proof of concept that would be able to handle something as complex as IEF.

slashrsm’s picture

Status: Active » Needs review

This is still work in progress, but basic functionality is there. Still need to be done:
- clean-up
- Handle removal and new selection
- Automatically submit select step after EB has propagated it's selection

https://github.com/drupal-media/entity_embed/pull/190

slashrsm’s picture

Issue summary: View changes
Status: Needs review » Needs work

Updated issue summary and explained what needs to be done.

slashrsm’s picture

slashrsm’s picture

Status: Needs work » Needs review
slashrsm’s picture

Status: Needs review » Needs work

Few comments on pull.

slashrsm’s picture

slashrsm’s picture

  • webflo committed c86ffe1 on 8.x-1.x
    Issue #2510596 by slasrsm, webflo, berdir: Use entity browser for...
Wim Leers’s picture

Can you post a screenshot in the future? Makes it easier for those following along to see what this actually looks like :)

slashrsm’s picture

Issue summary: View changes
FileSize
266.14 KB
1.37 MB

Sure. Sprint was so intensive we forgot about this.

Status: Fixed » Closed (fixed)

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