Problem/Motivation // Steps to reproduce

Just installed webform_entity_handler 2.0.4, using webform 6.2.10, Drupal 10.6.7 and PHP 8.3.

I followed the instructions for how-to-use listed in another issue, and the moment I click the Add handler button for Entity, I immediately get an Error message "Oops, something went wrong. Check your browser's developer console for more details.", and in the log it says:

Error: Call to a member function __toString() on string in Drupal\webform_entity_handler\Plugin\WebformHandler\WebformEntityHandler->getEntityTypes() (line 536 of /var/www/html/web/modules/contrib/webform_entity_handler/src/Plugin/WebformHandler/WebformEntityHandler.php).

I've tried a brand new webform, and also other existing webforms with many elements. Same error.

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

fizcs3 created an issue. See original summary.

fizcs3’s picture

Issue summary: View changes
gaddman’s picture

I'm experiencing this too. When I created the webform it worked fine but at some point it has stopped working. I found if I remove any HTML items from my form the problem goes away, and looking at the error it's because those elements have no Title attribute. Changing this line resolves the problem:

# Original:
'@title' => $element['#title'],
# New:
'@title' => $element['#title'] ?? '',

I can do an MR later if you need. But I haven't looked into where that title is later used and if an empty string is OK or if perhaps it should have some other default provided.

gaddman’s picture

Status: Active » Needs review

Created a MR which sets a default title of the webform key surrounded by square brackets, ie same approach as the webform module itself.