Problem/Motivation
myrest.module still calls \Drupal::urlGenerator(), \Drupal::service('module_handler'), \Drupal::token() and \Drupal::logger(). In procedural hooks these calls are sometimes unavoidable, but most of this logic belongs in a service.
Proposed resolution
- Move the token/menu-link logic into a service and let the hook delegate to it.
- Use
Url::fromRoute()inhook_help()instead of the URL generator. - Document any remaining static call that is genuinely required by the hook context.
Remaining tasks
Extract the logic and add unit tests for the new service.
User interface changes
None.
API changes
New service for menu link URI handling.
Issue fork myrest-3615507
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 #4
sergeydruua commentedComment #6
sergeydruua commented