hook_confirmer() improve checks / non-webform context

Created on 1 July 2024, 5 months ago

Problem/Motivation

The drupal/webform_double_opt_in module is currently causing an error, which makes it impossible to use the drupal/email_confirmer module without the webform context.

The error:

```
TypeError: Drupal\webform_double_opt_in\Event\OptedInEvent::__construct(): Argument #1 ($webformId) must be of type string, null given, called in /var/www/html/web/modules/contrib/webform_double_opt_in/webform_double_opt_in.module on line 36 in Drupal\webform_double_opt_in\Event\OptedInEvent->__construct() (line 63 of modules/contrib/webform_double_opt_in/src/Event/OptedInEvent.php).
```

Steps to reproduce

I have a custom email_confirmer integration using \Drupal::service('email_confirmer')->confirm('somemail@example.com'); that triggers on node insert. This implementation is unrelated to webform. However, the webform_double_opt_in module triggers an error when webform_* properties are missing in the confirmation object.

I need to keep the drupal/webform_double_opt_in module enabled for another feature.

Proposed resolution

Improve checks in hook_confirmer($op, $confirmation) so that webform_double_opt_in functionality is executed only when it's in a webform context.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

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

Comments & Activities

Production build 0.71.5 2024