Module is not stable for drupal 8.4.x, drupal 8.3.x.

Entity types not displaying while creating entity embed button and after saving the form, edit is throwing error.

mod_fcgid: stderr: Uncaught PHP Exception InvalidArgumentException: "Missing required properties for an EntityDisplay entity." at /Users/kumsu25/Sites/devdesktop/docops-upgrade3/docroot/core/lib/Drupal/Core/Entity/EntityDisplayBase.php line 122, referer: https://docops-upgrade3.dd:8443/en-us/admin/config/content/embed

Issue fork videojs-2933497

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

suresh kumara created an issue. See original summary.

wim leers’s picture

Category: Bug report » Support request
Status: Active » Closed (cannot reproduce)
Issue tags: +Needs steps to reproduce

That's thrown by:

  public function __construct(array $values, $entity_type) {
    if (!isset($values['targetEntityType']) || !isset($values['bundle'])) {
      throw new \InvalidArgumentException('Missing required properties for an EntityDisplay entity.');
    }

I certainly cannot reproduce this. I also don't see how entity_embed could possibly trigger this, since it does not construct EntityDisplayBase subclass objects.

Even though I cannot reproduce this nor can I fathom how, if you can, then please reopen this issue and provide concrete steps to reproduce. Thanks! 🙏

selfirian’s picture

I have the same issue, it occurs when tryinig to edit an entity embed, I'm trying to use this with the media library from core.
I does work but I'm unable to modify the button's icon.

chrsnlsn’s picture

I'm also running into this with core media library can't create an embed button, when I use the dropdown to select the embed type "entity" nothing gets returned and this error shows up in the logs.

Uncaught PHP Exception InvalidArgumentException: "Missing required properties for an EntityDisplay entity." at /var/www/html/web/core/lib/Drupal/Core/Entity/EntityDisplayBase.php line 122
rgreeott01’s picture

I'm experiencing the same issue as defined by Slefirian & Chrsnlsn. From my logi file

Uncaught PHP Exception InvalidArgumentException: "Missing required properties for an EntityDisplay entity." at /srv/bindings/dcbce8fe2fa54462bf1e1f7b7ea17bae/code/core/lib/Drupal/Core/Entity/EntityDisplayBase.php

iyyappan.govind’s picture

I am getting the same error.

iyyappan.govind’s picture

Status: Closed (cannot reproduce) » Active
iyyappan.govind’s picture

It is throwing error while $entity_type = entity_form_display.

wim leers’s picture

That can only happen if you have an EntityDisplayInterface entity that has either no targetEntityType or no bundle. (i.e. the code I quoted in #2.)

Are any of you using custom entity displays?

iyyappan.govind’s picture

Hi @Wim Leers ,

Yes we custom entity display which is coming from videojs module. Videojs module provides field formatter called VideoJsPlayerFormatter. It showing this error in below code because we are calling isApplicable() function

  /**
   * {@inheritdoc}
   */
  public static function isApplicable(FieldDefinitionInterface $field_definition) {
    $entity_form_display = entity_get_form_display($field_definition->getTargetEntityTypeId(), $field_definition->getTargetBundle(), 'default');
    $widget = $entity_form_display->getRenderer($field_definition->getName());
    $widget_id = $widget->getBaseId();
    if(!$field_definition->isList()){
      return TRUE;
    }
    return FALSE;
  }

Thanks

vighneshh’s picture

Do we have any solution for this issue facing the exact issue while migrating a site from drupal7 to drupal 9

dave reid’s picture

Title: Entity types not displaying while creating entity embed button and after saving the form, edit is throwing error. » VideoJsPlayerFormatter::isApplicable() can throw uncaught exceptions and should probably just be removed
Project: Entity Embed » Video.js (HTML5 Video Player)
Version: 8.x-1.0-beta2 » 8.x-1.x-dev
Category: Support request » Bug report
Issue tags: -Needs steps to reproduce

Well there look to be several things wrong with that isApplicable method in videojs:

1. Not being defensive in calling entity_get_form_display() and checking for an exception if the given form mode doesn't exist.
2. It does all that to not even use the variables, all it's doing is checking $field_definition->isList(), which I'm still not sure why because even single-value fields are still lists, of just one value.

This needs to be fixed upstream in videojs to probably just remove that isApplicable method entirely.

dave reid’s picture

Title: VideoJsPlayerFormatter::isApplicable() can throw uncaught exceptions and should probably just be removed » VideoJsPlayerFormatter::isApplicable() needlessly loads entity form displays which can throw exceptions
Status: Active » Needs review

_shY made their first commit to this issue’s fork.

  • _shY committed 837d02ee on 8.x-1.x authored by Dave Reid
    Issue #2933497: Field formatters' isApplicable() needlessly loads entity...

  • _shY committed df56d40f on 3.x
    Issue #2933497 by Dave Reid, _shY: VideoJsPlayerFormatter::isApplicable...
_shy’s picture

Status: Needs review » Fixed

I like it, thanks.
Merged in 8.x-1.x and 3.x branches.

Status: Fixed » Closed (fixed)

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