Skip to main content
added 105 characters in body
Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

If you have the same container parameter name in different modules the module last in alphabetic order will overwrite previous values. The solution would be to prefix the parameter name with the module name if it is specific to this module.

But why use parameters when you can use string literals?

my_module_nodes.services.yml

services:
  my_module_nodes.subscriber:
    class: \Drupal\my_module_nodes\EventSubscriber\MyModuleNodesSubscriber
    arguments: ['@cache.render', '@current_route_match', 'entity.node.canonical', 'node']
    tags:
    - { name: event_subscriber }

If you have the same container parameter name in different modules the module last in alphabetic order will overwrite previous values.

But why use parameters when you can use string literals?

my_module_nodes.services.yml

services:
  my_module_nodes.subscriber:
    class: \Drupal\my_module_nodes\EventSubscriber\MyModuleNodesSubscriber
    arguments: ['@cache.render', '@current_route_match', 'entity.node.canonical', 'node']
    tags:
    - { name: event_subscriber }

If you have the same container parameter name in different modules the module last in alphabetic order will overwrite previous values. The solution would be to prefix the parameter name with the module name if it is specific to this module.

But why use parameters when you can use string literals?

my_module_nodes.services.yml

services:
  my_module_nodes.subscriber:
    class: \Drupal\my_module_nodes\EventSubscriber\MyModuleNodesSubscriber
    arguments: ['@cache.render', '@current_route_match', 'entity.node.canonical', 'node']
    tags:
    - { name: event_subscriber }
Source Link
4uk4
  • 101.7k
  • 7
  • 173
  • 217

If you have the same container parameter name in different modules the module last in alphabetic order will overwrite previous values.

But why use parameters when you can use string literals?

my_module_nodes.services.yml

services:
  my_module_nodes.subscriber:
    class: \Drupal\my_module_nodes\EventSubscriber\MyModuleNodesSubscriber
    arguments: ['@cache.render', '@current_route_match', 'entity.node.canonical', 'node']
    tags:
    - { name: event_subscriber }