monster_menus-9.0.x-dev/monster_menus.services.yml
monster_menus.services.yml
services:
# Perform tasks at the end of the page request.
monster_menus.exit_subscriber:
class: Drupal\monster_menus\EventSubscriber\ExitSubscriber
tags:
- { name: event_subscriber }
# Converts incoming paths like "/foo/bar/baz" or "/MMTID" to "mm/MMTID".
monster_menus.path_processor_inbound:
class: Drupal\monster_menus\PathProcessor\InboundPathProcessor
tags:
- { name: path_processor_inbound, priority: 900 }
# Expands outgoing paths from "/mm/MMTID" to "/foo/bar/baz" format.
monster_menus.path_processor_outbound:
class: Drupal\monster_menus\PathProcessor\OutboundPathProcessor
tags:
- { name: path_processor_outbound, priority: 900 }
# Caches MM page access calculations.
cache.mm_access:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory: cache_factory:get
arguments: [mm_access]
# Sets the current theme based on the MM page.
theme.negotiator.monster_menus:
class: Drupal\monster_menus\Theme\PageThemeNegotiator
tags:
- { name: theme_negotiator, priority: 0 }
arguments: ['@database']
# Alters existing menu routes to include special handing for MM.
monster_menus.route_subscriber:
class: Drupal\monster_menus\Routing\RouteSubscriber
tags:
- { name: event_subscriber }
# Provides a route processor to replace unresolved {mm_tree} path elements
# with the current page's MMTID.
monster_menus.route_processor:
class: Drupal\monster_menus\Routing\OutboundRouteProcessor
arguments: ['@current_route_match']
tags:
- { name: route_processor_outbound, priority: 300 }
# Overrides DefaultMenuLinkTreeManipulators to allow for menu links which
# contain unspecified {mm_tree} parameters.
menu.default_tree_manipulators:
class: Drupal\monster_menus\Menu\MenuLinkTreeManipulators
arguments: ['@access_manager', '@current_user', '@entity_type.manager', '@module_handler']
# Renders a portion of the MM tree as links.
monster_menus.tree_renderer:
class: Drupal\monster_menus\MMRenderer\DefaultMMRenderer
# Creates an entire path of MM tree IDs.
monster_menus.mm_create_path:
class: Drupal\monster_menus\MMCreatePath\MMCreatePath
arguments: ['@database']
monster_menus.breadcrumb:
class: Drupal\monster_menus\Breadcrumb\MMBreadcrumbBuilder
tags:
- { name: breadcrumb_builder, priority: 100 }
# Plugin provides data for MMTreeBrowserController to render various entities
plugin.manager.mm_tree_browser_display:
class: Drupal\monster_menus\MMTreeBrowserDisplay\MMTreeBrowserDisplayManager
parent: default_plugin_manager
# Plugin provides data for MMSearchAction to perform tasks on search results
plugin.manager.mm_search_action:
class: Drupal\monster_menus\MMSearchAction\MMSearchActionManager
parent: default_plugin_manager
# Override \Drupal\Core\Session\AccountProxy to include permissions checking
# which takes roles tied to MM groups into account.
current_user:
class: Drupal\monster_menus\Session\AccountProxy
arguments: ['@event_dispatcher']
# Override Drupal\Core\Cache\Context\AccountPermissionsCacheContext to provide
# cache contexts that include roles tied to MM groups.
cache_context.user.permissions:
class: Drupal\monster_menus\Cache\Context\AccountPermissionsCacheContext
arguments: ['@current_user', '@user_permissions_hash_generator']
tags:
- { name: cache.context}
# Override Drupal\Core\Access\CustomAccessCheck to handle the case where a
# route has an unresolved {mm_tree} parameter.
access_check.custom:
class: Drupal\monster_menus\Access\CustomAccessCheck
arguments: ['@callable_resolver', '@access_arguments_resolver_factory']
tags:
- { name: access_check, applies_to: _custom_access }
# Check and optionally repair the tree structure.
monster_menus.validate_sort_index:
class: Drupal\monster_menus\ValidateSortIndex
arguments: ['@database']
# Check for orphan nodes, and optionally move them to a page.
monster_menus.check_orphan_nodes:
class: Drupal\monster_menus\CheckOrphanNodes
arguments: ['@database']
# Print a CSV dump of the entire MM tree.
monster_menus.dump_csv:
class: Drupal\monster_menus\DumpCSV
