Failing assertion when editing webform elements.

Created on 22 February 2023, over 1 year ago

Problem/Motivation

This module throws some errors when trying to add an element to a webform and assertions are enabled, like on a typical devel site.

The issue seems to be the webform element preview not having any default value, and still trying to load some entity with null ID...

There's some exception handling in the module's code, which possibly wouldn't be needed if we could add some simple checks before attempting entity loading.... and still it doesn't help when assertions enabled...

The error:

AssertionError: Cannot load the "node" entity with NULL ID. in assert() (Zeile 295 in /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php)
#0 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(295): assert(false, 'Cannot load the...')
#1 /var/www/html/docroot/modules/contrib/webform_entity_view/src/Plugin/WebformElement/WebformEntityView.php(177): Drupal\Core\Entity\EntityStorageBase->load(NULL)

Not a major issue but pretty annoying when you work on a dev environment developing webform elements...

Steps to reproduce

0. On your dev environment, make sure assertions are enabled, https://www.drupal.org/node/2569701
1. Enable the module.
2. Edit any webform / Add element

Proposed resolution

Quick check, do not try entity loading if no configured entity.

Patch will follow.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain Jose Reyero

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024