Logs flooded with warning messages "Invalid display settings encountered"

Created on 26 August 2019, about 5 years ago
Updated 14 March 2023, over 1 year ago

In #3010942: More defensive handling of "data-entity-embed-display-settings" β†’ some code was added that logs a warning message if an embed token contains a non-array value for attribute "data-entity-embed-display-settings". However in my testing with using the "view_mode" entity embed display plugin, the value of this attribute will always be an empty array.

Steps to reproduce:

  • Enable Entity Embed, Embed, and Media modules.
  • Create an image media entity.
  • Create an embed button for embedding media. Don't restrict any display plugins (so that they are all available).
  • Delete the existing embed button for embedding nodes (makes next step less confusing)
  • Configure full HTML text filter/editor so that the embed button is available, and so that the entity embed text filter is enabled.
  • Add a new Page node and click embed button to embed media. Select the name of the media entity. For the "display as" dropdown, select "Full content". Leave everything else (alt, caption, alignment) blank.
  • Embed it.
  • View source in CKEditor, and observe that there's a data-entity-embed-display-settings attribute with an empty string as value.

I guess the solution here is twofold:

  1. Prevent empty string from being added as the attribute.
  2. If an empty string did end up as an attribute, adjust the logic the embed filter so that it does not log a warning if it encounters an empty string.
πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡―πŸ‡΄Jordan ammar qala

    I faced the same issue and fixed it, instead of applying patch #10 I decided to know what is the root cause.
    In my case I found out another related error which helped me out

    Drupal\entity_embed\Exception\EntityNotFoundException: Unable to load embedded media entity 36beb6db-45f7-40a9-8799-b4fa8388cbc1. in Drupal\entity_embed\Plugin\Filter\EntityEmbedFilter->process() (line 162 of /var/www/html/xxx/web/modules/contrib/entity_embed/src/Plugin/Filter/EntityEmbedFilter.php).

    and followed the below comment
    https://www.drupal.org/project/entity_embed/issues/2982322#comment-12866696 β†’

Production build 0.71.5 2024