This patch migrates all 19 procedural hook implementations across the main module and both sub-modules to OOP classes using Drupal 11's #[Hook] attribute pattern, with #[LegacyHook] stubs in .module files for Drupal 10.3+ backward compatibility.

Changes

New hook classes (main module):

  • src/Hook/WebformWorkflowsElementHooks.php — 5 hooks: webform_submission_view, webform_element_access, webform_submission_presave, webform_submission_access, entity_operation_alter
  • src/Hook/EntityTypeHooks.php — 1 hook: entity_type_alter (isolated to prevent circular service dependency)
  • src/Hook/FormHooks.php — 3 hooks: form_alter, webform_element_webform_workflows_element_alter, webform_submission_form_alter + static form callbacks
  • src/Hook/ThemeHooks.php — 1 hook: theme + template_preprocess_webform_workflows_element_value
  • src/Hook/TokenHooks.php — 2 hooks: token_info, tokens
  • src/Hook/ResultsFilterHooks.php — 4 hooks: form_webform_submission_filter_form_alter, webform_better_results_query_alter, webform_better_results_form_alter, webform_better_results_submit_alter

New hook classes (sub-modules):

  • modules/webform_workflows_element_views/src/Hook/ViewsHooks.php — 1 hook: views_data
  • modules/webform_workflows_element_maestro/src/Hook/MaestroHooks.php — 2 hooks: task_console_interactive_link_alter, execute_title

Deleted .inc files (contents merged into .module):

  • webform_workflows_element.tokens.inc
  • webform_workflows_element.results_filter.inc
  • webform_workflows_element.logs.inc
  • webform_workflows_element.colors.inc

Deprecated helper functions: All non-hook procedural functions remaining in .module are marked @deprecated in webform_workflows_element:2.1.0 and is removed from webform_workflows_element:3.0.0.

Circular dependency fix: hook_entity_type_alter is isolated in its own EntityTypeHooks class (depends only on @module_handler) to avoid a circular reference through the webform_workflows_element.manager service during entity type discovery.

Updated: WebformSubmissionWorkflowListBuilder now calls ResultsFilterHooks via the service container instead of the procedural function directly.

Backward compatibility

Each procedural hook in .module files is retained as a #[LegacyHook] stub that delegates to the corresponding service class. All hook classes are explicitly registered in services.yml for Drupal 10.x compatibility (where HookCollectorPass is not available).

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

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

  • mably committed 43d9fda0 on 2.x
    task: #3576232 Migrate procedural hooks to OOP #[Hook] attributes with...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.