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() in hook_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

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

sergeydruua created an issue. See original summary.

  • sergeydruua committed 41be678f on 1.0.x
    Issue #3615507: Remove remaining static \Drupal:: calls from myrest....
sergeydruua’s picture

Status: Active » 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.

sergeydruua’s picture

Status: Fixed » Closed (fixed)