Currently, when using entity_browser_entity_reference field widget with modal, the widget is not updated after the Edit modal form is submitted. So the widget does not reflect the possible changes made to the referenced entity.

Comments

Leksat created an issue. See original summary.

leksat’s picture

Status: Active » Needs review
StatusFileSize
new5.14 KB

Here is a working patch. Manually tested by me.

Status: Needs review » Needs work

The last submitted patch, 2: 2773043-2.patch, failed testing.

The last submitted patch, 2: 2773043-2.patch, failed testing.

leksat’s picture

Oh, EntityReference was renamed. Will reroll tomorrow.

leksat’s picture

Status: Needs work » Needs review
StatusFileSize
new5.19 KB

Rerolled against latest 8.x-1.x branch.

  • slashrsm committed 12e8086 on 8.x-1.x authored by Leksat
    Issue #2773043 by Leksat: Update the field widget after the Edit modal...
slashrsm’s picture

Status: Needs review » Fixed
Issue tags: +D8Media

Looks great! Thank you for contributing to and using Entity browser.

mtodor’s picture

Status: Fixed » Needs review
StatusFileSize
new341 bytes
new1.87 KB

With this patch, I get error when EB is used for field of media entity. When I try to add/edit media entity that uses field with EB, I get following error:
Uncaught TypeError: Cannot read property 'prototype' of undefined
for:
Drupal.AjaxCommands.prototype.entity_browser_value_updated = function (ajax, response, status) {

So possible solution is to add ajax dependency for: js/entity_browser.common.js, like I have provided in patch.
But in that case I'm not sure do we need defined dependencies in other parts of code:

  1. src/Plugin/EntityBrowser/Display/Modal.php
  2. src/Controllers/EntityBrowserController.php

I have attached zipped test module, so after it's installed just go to add media and error should be reproducible.

slashrsm’s picture

Status: Needs review » Fixed

Committed. Thanks!

  • slashrsm committed 3875750 on 8.x-1.x authored by mtodor
    Issue #2773043 by mtodor: Add missing library dependency.
    

Status: Fixed » Closed (fixed)

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