Skip to content

008: What the 1.x API of Sites is

Status: accepted, 2026-11-14.

Context

After 1.0.0, every break of public API needs a 2.0. Until then, the betas removed APIs without a deprecation, and nothing written said what counts as API. The service map and Services, plugins, hooks, events name what other modules should use, and 003 pins the attribute constructors. Everything else was public by accident: in sites and its submodules, about 350 types carry no @internal, 180 of them hook classes, plugins, forms, controllers, subscribers and access checks. Read literally, a constructor change in any of them would break 1.x.

The plans after the release candidate add methods to service interfaces and change the constructors of plugins and services. None of that should need a 2.0. Satellites and client modules implement none of the service interfaces: they call them.

Decision

The 1.x API of sites and sites_content_overrides is, as in the Drupal core BC policy, a short list, and everything else is not API:

API Not API
The service IDs and interfaces of the service map and of reference/api.md Constructors of services, plugins, forms and controllers
The attributes (003), plugin base classes and the value objects of sections Hook classes and plugin implementations
Events, and hooks documented in *.api.php Event subscribers, access checks, decorators, Drush commands, batch callbacks
The route options and requirements in SitesRouteOption, the URL options in SitesUrlOption Everything marked @internal, a class or a single method
  • Service and plugin manager interfaces are for calling, not for implementing. A new method arrives in a minor release.
  • A plugin base class keeps its constructor parameters in 1.x. Subclasses build through create(): they call parent::create() and set their own services on the instance. ContentSite is such a base.
  • Test traits and test base classes (SitesFunctionalTestBase, SitesKernelTestBase, SiteCreationTrait, …) are test API: they only grow in 1.x, and a change goes into the CHANGELOG.

Consequences

  • Types that look like API but have no users and are no extension point are tagged @internal: concrete implementations of service interfaces, helper traits, and the internals of overrides, settings and Views. InternalSitesApiGuardTrait reads the tag, so a satellite's NoInternalSitesApiTest covers them without a list.
  • Changing a non-API constructor, or adding a method to a service interface, needs no deprecation and no 2.0.
  • A satellite or client module that needs something not on the list asks for it in the sites issue queue (see Core APIs for satellites).

Rejected options

  • @internal on every class that is not API: some 200 tags to keep in step, and every new class would need one. Core draws the line by kind, not by tag.
  • final on every implementation: stops subclasses but not a constructor call, and blocks projects that swap a service class for a subclass to carry a fix.
  • No record, decide case by case: every plan after the release candidate would reopen the question for its own interfaces.

Reopen when

Planning for 2.0 starts, or a project outside the suite implements a service interface.

Last updated 2026-11-14