- Issue created by @soumyajit40cs
1. Create a Custom Module
2. Implement hook_help():
In the custom_submission_filter.module file, add the hook_help() implementation to provide information about the module:/**
* Implements hook_help().
*/
function custom_submission_filter_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.custom_submission_filter':
return '' . t('Modifies the WebformSubmissionWorkflowListBuilder class to handle empty Workflow Steps data.') . '
';
}
}3. Implement hook_webform_submission_filter_query_alter():
Now, implement the hook_webform_submission_filter_query_alter() hook to override the WebformSubmissionWorkflowListBuilder class behavior. In the custom_submission_filter.module file, add the following code:use Drupal\webform\Plugin\WebformHandler\EmailWebformHandler;
use Drupal\Core\Entity\Query\QueryInterface;/**
* Implements hook_webform_submission_filter_query_alter().
*/
function custom_submission_filter_webform_submission_filter_query_alter(QueryInterface $query, $form_id) {
// Get the Workflow Steps data count.
$workflow_steps_count = count(\Drupal::entityQuery('webform_submission_workflow_step')
->condition('webform', $form_id)
->execute());// If there are no Workflow Steps data, set the total count to 1.
if ($workflow_steps_count === 0) {
$query->addExpression('1', 'total');
}
}- 🇮🇳India soumyajit40cs
Hi @Aswathy25 ,
Based on your suggestion I have tried in my system, but it's not working.
- 🇳🇴Norway gisle Norway
The code snippet provided by Aswathy25 in comment #2 looks like AI Generated Content.
Please note that Our policy on AI Generated Content → requires those posting such content to:
- Disclose that AI was used in crafting the code or content.
- Carefully review and test the output, to ensure it is relevant, and that it works.
- Provide human intervention to correct inaccuracies, mistakes, or broken code.
I am a site moderator on Drupal.org and must point out that posting AI Generated Content that violates this policy will result in a ban.
This patch is a rewrite of the solution in #5, which works but is less readable.