Problem/Motivation

Hooks are not being triggered.

Proposed resolution

Move MetadataSanitizerHooks to the Drupal\metadata_sanitizer\Hook namespace, instead of Drupal\metadata_sanitizer\Hooks

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

dieterholvoet created an issue. See original summary.

dieterholvoet’s picture

Assigned: dieterholvoet » Unassigned
Status: Active » Needs review
zarabatana’s picture

Status: Needs review » Needs work

Thanks for MR !10 — the direction is correct (moving to src/Hook / Drupal\metadata_sanitizer\Hook and updating the service).
Two follow-ups needed before the merge:

The moved file currently has two namespace lines; please remove namespace Drupal\metadata_sanitizer\Hooks; so it only has namespace Drupal\metadata_sanitizer\Hook;.

Since the module supports Drupal 10, please add procedural shim hooks in metadata_sanitizer.module marked #[LegacyHook] that forward to the hook service (for hook_file_insert() and hook_help()), so hooks run on D10 and don’t double-run on D11.

dieterholvoet’s picture

I checked and there aren’t two namespace lines. We can add the fallback for older versions here, but it’s not really in scope for this bug fix. Feel free to do this yourself, not sure if I’ll find the time in the coming weeks.

dieterholvoet’s picture

Status: Needs work » Needs review
zarabatana’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! MR !10 correctly moves the hook implementation into src/Hook (Drupal\metadata_sanitizer\Hook), so it’s discovered and executed as expected, and the services.yml update follows suit. I’m marking RTBC and proceeding to merge.

zarabatana’s picture

Status: Reviewed & tested by the community » Fixed

MR !10 is now merged. This moves the hook implementation to src/Hook (Drupal\metadata_sanitizer\Hook) so it’s correctly discovered/executed. Marking this issue fixed/closed.

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.

zarabatana’s picture

Status: Fixed » Closed (fixed)