Move DevelGenerate plugin to a new webform_devel_generate module within this project

Created on 15 January 2025, 3 months ago

Problem/Motivation

Devel Generate (devel_generate) is part of the Devel (devel) module and allows users to generate mock content of various entity types (for example, nodes).

Devel Generate uses Drupal's plugin system to allow other modules to provide code to extend the it.

Webform defines a Devel Generate extension at \Drupal\webform\Plugin\DevelGenerate\WebformSubmissionDevelGenerate.

Currently, if certain version combinations of Webform versions and Devel Generate versions (see Steps to reproduce) are enabled on any environment, along with email handlers, a PHP fatal error can occur due to incompatibilities.

At least one fix requires a check against the version of Devel Generate, for example in this fix to one such problem :

+  if (!empty($info['version']) && strpos($info['version'], '8.x-') === 0) {
+    $generators['webform_submission']['class'] = 'Drupal\webform\Plugin\DevelGenerate\WebformSubmissionDevelGenerateDeprecated';
+  }

If such an error occurs, it can prevent submissions of Webforms, even on environments which do not use Devel Generate to generate webform submissions.

Steps to reproduce

See 🐛 [Drupal 9.x] Declaration of Drupal\webform\Plugin\DevelGenerate\WebformSubmissionDevelGenerate::validateDrushParams($args) must be compatible with Drupal\devel_generate\DevelGenerateBaseInterface::validateDrushParams(array $args, array $options = Array) Fixed

See 🐛 Fatal error: Type of Drupal\webform\Plugin\DevelGenerate\WebformSubmissionDevelGenerate::$entityTypeManager must be Postponed: needs info

Proposed resolution

Move all devel_generate-related code to its own module, which will only be activated by users who require that functionality. That way, if another error similar to the one documented in Steps to Reproduce occurs, it will affect fewer sites.

Remaining tasks

Move all devel_generate-related code to its own module.

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

6.3

Component

Code

Created by

🇨🇦Canada alberto56

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

Comments & Activities

  • Issue created by @alberto56
  • 🇨🇦Canada alberto56

    Something like the following code in your custom module might help if you're experiencing a fatal error because of this:

    /**
     * Implements hook_devel_generate_info_alter()
     */
    function MY_CUSTOM_MODULE_devel_generate_info_alter(array &$generators) {
      // https://www.drupal.org/project/webform/issues/3499830
      unset($generators['webform_submission']);
    }
    
    
Production build 0.71.5 2024