Problem/Motivation
Follow-up https://www.drupal.org/project/drupal/issues/3123211#comment-13605892
@xjm:
One could make the case that menu.api.php should give an example of using the service properly rather than assuming the example is for procedural or test code, but rewriting docs is a separate issue scope. Tagging "needs followup" for that.
Proposed resolution
Add an example near https://git.drupalcode.org/project/drupal/-/blob/8.8.x/core/lib/Drupal/C...
# foo_module.services.yml
foo_module.menu_link_tree_consumer
class: \Drupal\foo_module\MenuLinkTreeConsumer
arguments: ['@menu.link_tree']
# foo_module/src/MenuLinkTreeConsumer.php
...
Comments
Comment #2
kristen pol