Problem/Motivation

Hi guys,
I tried to embed a block in a WYSIWYG field with the Embed module but I got this AJAX error in my console :
Error: Call to a member function getFileUri() on null in media_directories_editor_form_entity_embed_dialog_alter()

Steps to reproduce

  1. Enable Embed module
  2. Click on Block embed button on a WYSIWYG field

Proposed resolution

Check the instance of the concerned entity before get the file URI.
Also made sure to only execute our code, if we're hooked from entiy embed dialog.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

JnLuC21 created an issue. See original summary.

ytsurk’s picture

Status: Active » Needs review

Thank you for reporting this issue.

So, if I understand right, we interfere with other entity embed buttons, right?
Your patch seems fine by a first look. I'll test next week.

JnLuC21’s picture

Hi @ytsurk,
Exactly I use embed buttons for blocks entity.
Thanks for the review

ytsurk’s picture

Title: Check if entity is a Media entity instance » Do not interfeer with other embed buttons
Version: 2.0.0 » 2.x-dev
Assigned: Unassigned » ytsurk
Priority: Normal » Major
Issue summary: View changes
Status: Needs review » Needs work
ytsurk’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.9 KB

As the form id is always the same, I check the against the button name, if we alter "our" form.

ytsurk’s picture

Assigned: ytsurk » Unassigned

  • ytsurk committed 61dfdba on 2.x
    Issue #3190828 by ytsurk, JnLuC21: Do not interfeer with other embed...
ytsurk’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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