Problem/Motivation
The commit for #3594081: Convert procedural hooks to object oriented hooks moved hook implementations into
Drupal\token_filter\Hook\TokenFilterHooks and registered it as an autowired service in token_filter.services.yml. However, the .module file still references
the service by its old-style ID token_filter.hooks, which no longer exists. This causes a fatal error on every page load:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "token_filter.hooks". in Drupal\Component\DependencyInjection\Container->get() (line 159 of core/lib/Drupal/Component/DependencyInjection/Container.php)
This is the same class of bug as Token's #3566706: You have requested a non-existent service "Drupal\\token\\Hook\\TokenHooks".
Steps to reproduce
- Install
drupal/token_filter:2.x-dev(any commit after June 8 2026) - Clear caches
- Visit any page
Proposed resolution
Add a service alias in token_filter.services.yml so the .module file's \Drupal::service('token_filter.hooks') calls resolve correctly:
services: Drupal\token_filter\Hook\TokenFilterHooks: autoconfigure: true autowire: true token_filter.hooks: alias: Drupal\token_filter\Hook\TokenFilterHooks
Issue fork token_filter-3606688
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
Comment #3
loze commentedComment #5
darvanenThanks for following up, however, the alias is not the approach core takes. I've made an adjustment, would you check it please?
Comment #6
loze commentedMy bad, you're right. This looks good. +1
Comment #8
darvanenThanks very much :)