Comments

lucas.constantino created an issue. See original summary.

mattgross’s picture

I second this request. This feature would be fantastic.

For example, I need to create some embeddable galleries for a client & it would be amazing if they could create said galleries from right on the page they were editing.

eveyrat’s picture

+1

khaled.zaidan’s picture

Yeah, agreed, this would be awesome.

Having that would give the potential of getting rid of so many fields and just having everything inside the WYSIWYG!

Has there been any progress on this? I might be able to put in sometime on this feature for the D8 version (especially if I manage to sell the idea to management at work).

Any update would be helpful :)

mattgross’s picture

It looks like there's been zero progress so far unfortunately. If you have the time & could pitch it go for it! :)

marcoscano’s picture

This is already possible if you use Entity Browser, which has a built-in integration with IEF. Have you tried that option?

arrow’s picture

Version: 7.x-3.x-dev » 8.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new8.71 KB

I took crack at this for 8.x. This patch adds a checkbox for enabling Inline Entity Form support for your embed button. Ticking the box turns the bundle selection field into a single value select field and is used to define the bundle that is used to create a new entity. It disables entity browser selection as this essentially modifies the default entity reference field.

Status: Needs review » Needs work

The last submitted patch, 7: entity_embed-inline_entity_form_integration-2679875-7.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

wim leers’s picture

Status: Needs work » Closed (works as designed)

This is already possible if you use Entity Browser, which has a built-in integration with IEF. Have you tried that option?

Exactly!

The project page even mentions this:

Related Modules

  • Entity Browser: When enabled, offers a more advanced embedded entity selection workflow.
rajab natshah’s picture

An update for the patch to work with latest version
As Entity Browser will have 3 or 2 and one more confirmation steps buttons.
A direct entity embed with a form mode for selected media types will be faster to embed

Inline Entity Form integration with Entity Embed

Hope that we could switch to the new way with Media Library
#2994699: Create a CKEditor plugin to select and embed a media item from the Media Library

rajab natshah’s picture

StatusFileSize
new16.46 KB

Better patch

rajab natshah’s picture

StatusFileSize
new15.61 KB

An optimization round for the patch

rajab natshah’s picture

StatusFileSize
new15.61 KB
rajab natshah’s picture

devkinetic’s picture

Status: Closed (works as designed) » Active

The patch from #13 did not integrate cleanly into my module, but I'm not sure if it's because I have a few other patches already or if the module itself has just changed too much. In either case, I rerolled the same code from the patch into my module and it ended up working great!

Our use case was that along with the media browser (using the Media Directories module), I wanted to setup dedicated "create media type" buttons, on the WYSIWYG as a shortcut. Using this patch, I was able to get that to work. The only thing I ran into is after the entity was created, in this case media, when I tried to edit the embed, it would open the same dialog. What I really wanted was for it to open with the media_directories, or media library dialog. I worked around this by using MYMODULE_entity_embed_values_alter() and just swapped out the $values['attributes']['data-embed-button'] value to be what I wanted it to be in an alter. If this gets any more traction we could add a new config value to allow writing that different value in the same manner to the token as I have done below:

/**
 * When using IEF to create an item, write a different embed button type to the token.
 *
 * @param array &$values
 * @param $entity
 * @param $display
 *
 */
function MYMODULE_entity_embed_values_alter(array &$values, $entity, $display) {
  // This could code from config
  $redirectEntityBrowser = 'different_browser';
  $values['attributes']['data-embed-button'] = $redirectEntityBrowser;
}

Anywho, this is a great feature, and while entity_browser can work, this is faster and more flexible out-of-the-box IMHO. For example, how would one use that module to create a button that allows you to upload PDFs into a "document" media type? Using this patch I can simply select that media type and check off the create checkbox. As far as I can tell, this is not possible with entity browser.

I reopened this because this solves a fundamental issue with media embedding. I want to create an item from a dialog from one module, and then later edit it with the features in another module. A best of both worlds approach. If I use the options available from entity_browser I am tied into their workflow. This ability allows us to create our own combinations.

devkinetic’s picture

I discovered a bug, wherein not all embed buttons use a browser, yet we check for a browser in: \Drupal\entity_embed\Form\EntityEmbedDialog::submitSelectStep

I changed it to the following:

if ($this->inlineEntityForm) {
  $form_state->set('step', $this->inlineEntityFormSettings['display_review'] ? 'review' : 'embed');
} else {
  $form_state->set('step', !empty($this->entityBrowserSettings['display_review']) ? 'review' : 'embed');
}
ieyara’s picture

I created a new patch based on 2679875-13.patch that includes:

  • fix provided by #16
  • fix of a bug when used with paragraphs: when you build an embed button with this type of entity, the widget of the bundle selector is a drop-down select (string variable) instead of a checkbox array (array variable). Function defaultConfiguration() was not aware of that
rajab natshah’s picture

Status: Active » Reviewed & tested by the community
rajab natshah’s picture

Status: Reviewed & tested by the community » Needs review
rajab natshah’s picture

StatusFileSize
new16.58 KB

Entity Embed 8.x-1.4 was released on: 8 Jun 2023 by: Dave Reid
https://www.drupal.org/project/entity_embed/releases/8.x-1.4


Thank you, Dave

Re-rolled the patch from #17 to work with Entity Embed 8.x-1.4

Status: Needs review » Needs work

The last submitted patch, 20: 2679875-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

rajab natshah’s picture

StatusFileSize
new14.69 KB

--

rajab natshah’s picture

Hitting a fatal error with #22
The code now is doing work for CKEditor 4 and Creditor 5 with the same code base.

Maybe a new logic is needed to cover both 4 and 5 at the same time.

rajab natshah’s picture

Assigned: Unassigned » rajab natshah
Status: Needs work » Active
rajab natshah’s picture

StatusFileSize
new14.29 KB
rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Active » Needs review
rajab natshah’s picture

StatusFileSize
new14.67 KB

Entity Embed 8.x-1.5 on: 6 Nov 2023 by: Dave Reid
https://www.drupal.org/project/entity_embed/releases/8.x-1.5


Thanks, Dave

Re-rolled the patch from #20 to work with Entity Embed 8.x-1.5

loze’s picture

This works fairly well in many cases, however when the IEF has a media browser field in it, when you click the button to open the media browser the entity embed IEF modal is replaced with the media browser, and clicking the insert media button closes the whole modal so nothing is ever added.

Clicking a media browser button (or any form element that opens a modal) should spawn a new modal on top. I'm not sure if this is something to address here or with the media module.

#2741877: Nested modals don't work: opening a modal from a modal closes the original