Skip to content

Services, plugins, hooks, events

The services, plugin types, hooks and events of the Sites modules. Each summary is the first paragraph of the docblock.

Services

Sites (sites)

Service Summary Tags
sites.kernel_request_subscriber Negotiates each main request's site and answers 404 where it does not serve. event_subscriber
sites.access_denied_subscriber Converts a "not this site's" 403 into a 404 on a site host. event_subscriber
sites.real_global_roles Answers "does a REAL global role grant this permission".
sites.site_role_manager Default site role manager backed by site_role_assignment entities.
sites.membership Answers which sites an entity belongs to, and its canonical site.
sites.content_assignment Decides who may put content on which site, and applies a site selection.
sites.field_membership_storage Membership storage for entities carrying their site in a site_id field. sites.membership_storage
sites.resolver Default site resolver: route → claiming site, via applies().
sites.user_access Answers which sites a user may work on, and builds site option lists. event_subscriber
sites.content_support Default content-support service derived from the sites' content setting.
sites.menu_tree_manipulators Keeps menu links to entities on another site visible.
sites.context_provider.site Provides the active site as the 'site' context for context-aware plugins. context_provider
current_site The current_site service: answers as the active site.
site_switcher Runs code as another site, on a stack of switches.
sites.content_version_context Answers which version a load delivers from the active site and the scopes.
sites.canonical_cron Runs cron on the canonical version of site content.
sites.canonical_request_subscriber Serves JSON:API and REST requests the canonical version of site content. event_subscriber
sites.initial_site_subscriber Claims a request for the main site whose host matches. event_subscriber
sites.hostname_alias_redirect_subscriber Redirects a site's alias hostnames to its hostname, permanently. event_subscriber
sites.vbo_actions_subscriber Keeps the site actions on offer in Views Bulk Operations. event_subscriber
sites.action_site_context The site a request's bulk actions are about.
sites.host_lookup Answers host and prefix lookups from the plugin manager's definition index.
sites.overrider The per-site configuration overrides, in one layer. config.factory.override
sites.config_override_repository Stores per-site configuration overrides and resolves them, cached per site.
sites.config_override_config_subscriber Keeps the stored overrides consistent with the objects they override. event_subscriber
sites.site_admin_permissions_subscriber Tells the caches when administrator roles stand for something else. event_subscriber
sites.file_usage Keeps file usage in step with the files a site's settings point at.
sites.config_target_settings Stores config_target settings as per-site configuration overrides.
sites.setting_layer_store Reads and writes one layer of a setting plugin's values for a site.
sites.site_settings Reads, validates and writes a site's settings outside the section form.
sites.lifecycle Creates, enables, arranges and deletes sites.
sites.members Lists a site's people and hands out its roles.
sites.scoped_entities Files a section's entities on sites: one per site, each judged on its own.
sites.section_form_scope Which section and which layer the current route edits.
cache_context.site Varies by the ACTIVE site — the site the code is currently running as. cache.context
cache_context.sites_context_site Varies by the site a hub request acts in. cache.context
cache_context.sites_negotiated_site Cache context for the negotiated site: the site the request arrived on. cache.context
cache_context.user.sites Cache context varying by the viewer's per-site access profile. cache.context
sites.user_sites_provider.roles The role-assignment contribution to the 'user.sites' cache context. sites.user_sites_provider
sites.site_setting_subscriber Applies per-site setting overrides defined in settings.php. event_subscriber
sites.site_settings_inheritance_subscriber Gives a sub-site its main site's hostname and, on request, its settings. event_subscriber
sites.trusted_hosts_middleware Adds every site hostname and alias to the trusted host patterns. http_middleware
url_generator.non_bubbling.decorator Generates a URL that targets another site as that site, on its hostname.
sites.settings_resolver Folds stored settings items into the resolved settings of a site.
sites.link_generator.decorator Keeps links to another site from getting the active-trail class.
sites.sites_selection.summary_builder Renders which sites an entity belongs to.
sites.access_check.site_content Access check for content operations on a site. access_check
sites.access_check.site_permission Access check for a per-site permission on a route's {site}. access_check
sites.capabilities The capability answers, asked with the permissions of whoever is asking.
sites.entity_access Decides what belonging to sites means for entity operations.
sites.access_check.site_admin_section Access to a per-site admin section. access_check
sites.access_check.setting_layer Access to a section form's layer routes: only a layer the site has. access_check
sites.access_check.site_admin_section_collection Gates a section's core collection route in a site context. access_check
sites.access_check.site_admin_section_config Binds a section's config hub route to REAL global administrators. access_check
sites.access_check.site_admin_section_scoped_overview Binds a section's config hub route to REAL global administrators. access_check
sites.route_subscriber.site_entity Lets the site entity's own routes carry a machine name. event_subscriber
sites.route_subscriber.site_admin_section_ui Turns each section's core collection route into its hub entry point. event_subscriber
sites.route_subscriber.site_admin_section Clones each section's core routes under /admin/sites/{site}/…. event_subscriber
sites.access_check.real_global_permission Gates an entity-less hub route on a REAL (assigned) global permission. access_check
sites.access_check.sites_selection_create Create access for the new-content selection modal. access_check
sites.param_converter Parameter converter for upcasting site IDs to site objects. paramconverter
sites.param_converter.site_entity Upcasts a site entity route parameter from the site's machine name. paramconverter
sites.access_check.site_is_hub Checks access based on whether the request arrived on the hub. access_check
sites.access_check.create Access for the content-creation site picker. access_check
sites.access_check.create_any Create-any-bundle access, OR-ing the per-site add capability in on the hub. access_check
sites.route_subscriber.hub_only Keeps the administration of sites on the hub. event_subscriber
sites.route_subscriber.create Bridges core's "add page" listing routes for per-site creators on the hub. event_subscriber
sites.subscriber.create_intercept Requires choosing a site before a content create form on the hub. event_subscriber
sites.role_permission_calculator The pure per-site role → permission math.
sites.pointed_site Reads the site a request points at, and how far to trust the pointer.
sites.access_policy Adjusts the Drupal-scope permissions for the site the request acts in. access_policy
Drupal\sites\Form\RemoveContentFromSite Provides a form to remove content from a site.
Drupal\sites\Form\AddContentToSite Provides a form for adding content to a site.
Drupal\sites\Form\SitesSelectionModalForm Builds a form for a modal which allows selecting sites.
sites.scoped_views Which views the suite scopes, and how.
sites.scoped_view_scope The one bounding step of a scoped view: what the viewer may select.

Sites clone (sites_clone)

Service Summary Tags
sites_clone.mapping Answers where a cloned entity ended up.
sites_clone.menu_cloner Copies the links of a site's per-site menus into the clone.
sites_clone.cloner Clones a site: the new one's basics, everything else from the source.

Sites content (sites_content)

Service Summary Tags
sites_content.membership_storage Membership storage backed by site_content_relationship rows. sites.membership_storage
sites_content.user_sites_provider The membership contribution to the 'user.sites' cache context. sites.user_sites_provider
sites_content.content_inventory Answers the site→content direction: what belongs to a site, and how firmly.
sites_content.disposition Detaches, reassigns or deletes a deleted site's content.
sites_content.site_resolver Resolves content sites for a route via the membership storage. sites.candidate_site_resolver

Sites content overrides (sites_content_overrides)

Service Summary Tags
sites_content_overrides.entity_types Answers which entity types sites may override, from the module's settings. event_subscriber
sites_content_overrides.cache_tags_invalidator Withholds named cache tags from invalidation while an override is written.
sites_content_overrides.site_aware_entity_resolver Resolves the revision a site serves and writes the override revisions.
Drupal\sites_content_overrides\Query\ServedVersionTables Rewrites entity queries and views on a site's host to the served revisions.
Drupal\sites_content_overrides\Query\ServedRevisionIndex Maintains the table of the override revision each site serves per entity. needs_destruction
sites_content_overrides.memory_cache Keeps the loaded entities of overridable types apart per content version.
sites_content_overrides.memory_cache_bin Keeps the loaded entities of overridable types apart per content version.
Drupal\sites_content_overrides\Form\OverrideDestination Keeps an override form's ?destination off an alias the submit removed.
sites_content_overrides.route_subscriber Adds the override routes of every overridable entity type. event_subscriber
sites_content_overrides.access_check.site_override Grants a per-site override route only for the route's {site}. access_check
sites_content_overrides.paramconverter.entity Upcasts a route's entity to the version the route needs.
sites_content_overrides.entity.repository Makes getActive() and getActiveMultiple() return the served version.
sites_content_overrides.service Edits, validates, saves and reverts a site's override of an entity.
Drupal\sites_content_overrides\OverridingSites Answers which member sites override an entity.
sites_content_overrides.config_subscriber Updates entity definitions when the overrideable entity types change. event_subscriber
sites_content_overrides.canonical_site_subscriber Adopts or deletes a site's override as the content's memberships change. event_subscriber
sites_content_overrides.override_cache_tags_subscriber Tags a response about an entity with the override tag of its site. event_subscriber
sites_content_overrides.layout_builder_site_context Renders a layout in the site it is edited for.

Sites content overrides Layout Builder (sites_content_overrides_layout_builder)

Service Summary Tags
sites_content_overrides_layout_builder.tempstore.route_enhancer Pins the site on a section storage loaded from the layout tempstore. route_enhancer
sites_content_overrides_layout_builder.service Tells whether an entity's bundle allows per-entity Layout Builder layouts.

Sites content overrides revisions (sites_content_overrides_revisions_ui)

Service Summary Tags
sites_content_overrides_revisions_ui.route_subscriber Adds the routes of a site's override revision history. event_subscriber

Sites devel (sites_devel)

Service Summary Tags
Drupal\sites_devel\DevelDumperManagerDecorator Opens Devel dumps to signed-in users in Sites development mode.

Sites Diff (sites_diff)

Service Summary Tags
sites_diff.overrides_operations_enhancer Enhances the site overrides operation list with a diff comparison link.
Drupal\sites_diff\Hook\SitesDiffHooks Adds a "Compare with canonical" diff link to the site overrides list.

Sites file (sites_file)

Service Summary Tags
sites_file.membership_storage Computes a file's sites from the content that uses it, on every read. sites.membership_storage

Sites language (sites_language)

Service Summary Tags
sites_language.overrider Language configuration override per site. config.factory.override
sites_language.languages The languages a site speaks.
sites_language.isolation_subscriber An entity page whose served translation the site does not speak is a 404. event_subscriber

Sites menu (sites_menu)

Service Summary Tags
sites_menu.service Maps a menu to the current site's own version of it.
sites_menu.site_menus A site's own menus: which they are, who manages them, what they are called.
Drupal\menu_ui\Plugin\Validation\Constraint\MenuSettingsConstraintValidator Site-aware replacement for core's MenuSettingsConstraintValidator.
sites_menu.membership_storage Membership storage for links stored under per-site menu variants. sites.membership_storage
sites_menu.capabilities The capability answers, asked with the permissions of whoever is asking.
sites_menu.menu_link_tree Loads the per-site variant of a menu in a site context.
sites_menu.menu_active_trail Resolves the active trail against the per-site variant of a menu.
sites_menu.access_check.menu_links Narrows the menu links overview and add-link form in a site context. access_check

Sites Metatag (sites_metatag)

Service Summary Tags
sites_metatag.link_builder The canonical URL and the hreflang alternates of a content page.

Sites path alias (sites_path_alias)

Service Summary Tags
sites_path_alias.alias_cleanup_subscriber Deletes a site's alias for content that has left the site. event_subscriber
Drupal\Core\Path\Plugin\Validation\Constraint\ValidPathConstraintValidator Site-aware replacement for core's ValidPathConstraintValidator.
sites_path_alias.content_paths Tells the system paths of site content from every other path.

Sites path prefix (sites_path_prefix)

Service Summary Tags
sites_path_prefix.parent_site Provides the 'main_site' context. context_provider
sites_path_prefix.service Reads site path prefixes and the request path without its language prefix.
sites_path_prefix.path_processor Processes inbound/outbound paths using the active site's prefix. path_processor_inbound, path_processor_outbound
sites_path_prefix.path_processor_front.decorator Serves a sub-site's front page at its bare prefix.
sites_path_prefix.initial_site_path_prefix_subscriber Resolves a sub-site from the request's hostname and path prefix. event_subscriber

Sites Pathauto (sites_pathauto)

Service Summary Tags
sites_pathauto.alias_generation_subscriber Generates a site's pathauto alias when content joins the site. event_subscriber
sites_pathauto.site_aliases_route_subscriber Provides the per-entity bulk alias form route for site content types. event_subscriber
Drupal\path\Plugin\Validation\Constraint\PathAliasConstraintValidator Site-aware replacement for core's PathAliasConstraintValidator.

Sites preview (sites_preview)

Service Summary Tags
sites_preview.access Decides who may render content in another site's context.
sites_preview.service Holds the site the current request previews.
sites_preview.switcher Where the viewer can go from a preview: another site's, or the real one.
sites_preview.language_overrides Keeps URL language detection on path prefixes inside a preview. config.factory.override
sites_preview.site_switch_subscriber Switches into the site named by the reserved '/preview/{site}' prefix. event_subscriber
sites_preview.admin_route_subscriber Sends admin routes back out of the preview namespace. event_subscriber
sites_preview.force_on_hub_subscriber Forces a site's content into its preview when it is reached on the hub. event_subscriber
sites_preview.front_page_subscriber Sends the hub's own front page to a preview of the user's site. event_subscriber
sites_preview.context_message_subscriber Tells the viewer which site they are looking at, and offers the others. event_subscriber
sites_preview.path_processor Strips and re-adds the preview prefix around the site's own paths. path_processor_inbound, path_processor_outbound
sites_preview.url_generator.decorator Keeps preview URLs on the hub host instead of the previewed site's host.
sites_preview.menu_tree_manipulators Decides a preview's admin links and tasks where they will be followed.
sites_preview.cache_context.site Tells a preview of a site apart from a visit to it, within 'site'.

Sites Redirect (sites_redirect)

Service Summary Tags
sites_redirect.route_subscriber.ui Turns /admin/config/search/redirect into the "whose redirects?" entry point. event_subscriber
sites_redirect.service Creates, validates, finds and deletes redirects per site.
sites_redirect.repository Looks redirects up per site.

Sites RobotsTxt (sites_robotstxt)

Service Summary Tags
sites_robotstxt.route_subscriber Serves /robots.txt through the site-aware controller. event_subscriber

Sites Search API (sites_search_api)

Service Summary Tags
sites_search_api.post_request_indexing Indexes after the request on the canonical version of site content.

Sites Shield (sites_shield)

Service Summary Tags
sites_shield.subscriber Challenges every request to a password-protected site with a 401. event_subscriber
sites_shield.page_cache_request_policy.disallow_basic_auth_requests Keeps credentialed requests to a shielded site out of the page cache. page_cache_request_policy
sites_shield.page_cache_response_policy.disallow_shielded_pages Response policy that prevents caching pages of a shielded site. page_cache_response_policy

Sites Simple XML Sitemap (sites_simple_sitemap)

Service Summary Tags
sites_simple_sitemap.config_subscriber Rebuilds the site caches when simple_sitemap's entity types change. event_subscriber
sites_simple_sitemap.route_subscriber Makes simple_sitemap's routes site-aware. event_subscriber
sites_simple_sitemap.membership_steering_subscriber Gives a site that adopts an entity the canonical site's sitemap settings. event_subscriber
sites_simple_sitemap.membership_storage Membership of a configuration entity, kept in its third-party settings. sites.membership_storage

Sites taxonomy (sites_taxonomy)

Service Summary Tags
sites_taxonomy.service Answers the taxonomy admin's site scope and its site-content vocabularies.
sites_taxonomy.term_queries Default implementation of the term-id scoping queries.

Sites UI (sites_ui)

Service Summary Tags
sites.site_cards Renders sites as the card grid of /admin/sites.
sites_ui.breadcrumb_builder Breadcrumbs for the Sites admin section (it lives in its own "sites" menu). breadcrumb_builder
sites_ui.access_reporter Read-only reporting over per-site role assignments and effective access.
Drupal\sites_ui\Controller\UnassignedContentReportController The unassigned-content triage report.
sites_ui.content_summary Aggregates a site's content membership into a "content at a glance" summary.
sites_ui.launch_checklist The launch checklist shown on a fresh site's dashboard.

Sites Webform (sites_webform)

Service Summary Tags
sites_webform.membership_storage Membership of a configuration entity, kept in its third-party settings. sites.membership_storage
sites_webform.assignment Reads and writes a webform's sites and lists webforms usable on given sites.
Drupal\sites_webform\WebformHostAccess Which host serves a webform: the hosts of the sites it is assigned to.
Drupal\sites_webform\WebformGroupUpgrade Adopts the webform assignments of the predecessor, sites_group_webform.

Plugin types

Sites (sites)

Plugin manager Summary
plugin.manager.site Discovers the sites the platform serves and indexes their hosts.
plugin.manager.site_setting Discovers the site setting plugins and redacts sensitive values.
plugin.manager.sites_launch_step Discovers the launch checklist steps and orders those a site shows.
plugin.manager.site_admin_section The admin sections available per site.

Sites clone (sites_clone)

Plugin manager Summary
plugin.manager.sites_clone_method Discovers the clone methods and lists the ones offered for an entity type.

Hooks

Sites (sites)

Hook Summary
hook_site_info_alter() Add or alter site plugin definitions.
hook_site_setting_info_alter() Alter the list of discovered site setting plugin definitions.
hook_sites_launch_step_info_alter() Alter the list of discovered launch step plugin definitions.
hook_site_admin_section_info_alter() Alter the list of discovered site admin section plugin definitions.
hook_sites_content_entity_types_alter() Alter the content entity types sites may hold.
hook_sites_shared_pool_content_entity_types_alter() Declare the content entity types whose site-less entities are on every site.
hook_sites_overview_views_alter() Alter the views the suite scopes as content overviews.
hook_sites_inheritance_ignore_alter() Alter the settings keys excluded from parent-to-child inheritance.
hook_site_access_alter() Alter the site gate: whether the active site serves the requested route.
hook_site_SITE_ID_access_alter() Alter the site gate of one site, by site ID.
hook_sites_site_delete_operations_alter() Alter the batch operations that run before a site is deleted.
hook_sites_entity_site_badges_alter() Alters the badges of the sites in an entity's site list.

Sites clone (sites_clone)

Hook Summary
hook_sites_clone_method_info_alter() Alters the clone methods a bundle can be cloned with.
hook_sites_clone_method_supports_entity_type_alter() Alters whether a clone method is offered for an entity type.

Sites content (sites_content)

Hook Summary
hook_sites_content_inventory_query_alter() Alter a query of the site content inventory.
hook_sites_content_disposition_delete_alter() Alter the deletion of content that is deleted with its site.

Sites content overrides (sites_content_overrides)

Hook Summary
hook_sites_content_overrides_operation_alter() Alters the operations available for a site override in the overview list.
hook_is_sites_content_overrides_field_overrideable_alter() Alters whether a field is considered overrideable for a site.
hook_sites_content_overrides_has_override_for_site_alter() Alters whether a site has an override of an entity.
hook_sites_content_overrides_pins_alter() Alters the pins a site override save records.
hook_sites_content_overrides_pin_label_alter() Alters the label of a pin on the revert form.
hook_sites_content_overrides_snapshot_alter() Alters a site override snapshot while it is being built.
hook_sites_content_overrides_aspects() Declares per-site override aspects of an entity.
hook_sites_content_overrides_revert_aspect() Reverts one declared aspect to canonical behaviour on a site.
hook_sites_content_overrides_aspect_values() Returns the site's current values of the declared aspects.
hook_sites_content_overrides_set_aspect() Sets one declared aspect for a site, as its override form section does.
hook_sites_content_overrides_effective_override_alter() Alters which override revision a site serves in place of the canonical one.

Sites Metatag (sites_metatag)

Hook Summary
hook_sites_metatag_own_variant() Whether a site serves its own variant of a content entity.

Sites Pathauto (sites_pathauto)

Hook Summary
hook_sites_pathauto_entity_update_alias_alter() Alter an entity just before its per-site pathauto alias is generated.

Sites UI (sites_ui)

Hook Summary
hook_site_dashboard_alter() Alter a site's dashboard.
hook_sites_status() Add entries to the Sites status report.
hook_sites_status_alter() Alter the entries of the Sites status report.

Events

Sites (sites)

Event Constant Summary
sites.content.add ContentEvent::ADD_EVENT_NAME Dispatched after an entity is added to a site.
sites.content.remove ContentEvent::REMOVE_EVENT_NAME Dispatched after an entity is removed from a site.
sites.content.canonical ContentEvent::CANONICAL_EVENT_NAME The canonical site of an entity was set or moved.
sites.initialize InitialSiteEvent::EVENT_NAME Dispatched before the request's site is sealed.
sites.settings_build SiteSettingsEvent::BUILD Dispatched once per site instance when its settings are resolved.