Replace the deprecated uri_callback entity type property
Replaces the deprecated uri_callback entity type property, which core deprecated in 11.4.0 for removal in 13.0.0.
Because the entity type declaration is now a PHP attribute, the deprecation fired twice: once at plugin discovery time (in the attribute constructor) and once per toUrl('canonical') call (in EntityType::getUriCallback()).
What changed
- Dropped
uri_callbackfrom theConfigEntityTypeattribute. Domain::toUrl()now handles thecanonicalrelation itself and delegates every other relation to the parent. A link template cannot be used because the canonical URL of a domain record points to another host.Domain::uri()is kept as the single source of URL construction.- New kernel test
DomainUrlTestcovering the canonical URL, the path prefix, option merging,toLink(), the other link relations, an ID-less record, and the absence of the property on the entity type.
Behavior
Unchanged. The override replicates what the callback path did, including the entity data passed through as options and the configuration entity convention of not setting an explicit language. The default relation (toUrl() with no argument) still resolves to the edit form, since the entity type has no canonical link template. The entity reference label formatter uses that default relation, so domain reference fields keep linking to the edit form.
Verified on Drupal 11.4.4
Before: the new test class reports the deprecation from both call sites in every test. After: the whole domain kernel suite (87 tests) and the three entity reference functional tests pass with no uri_callback deprecation left.
Noted, not fixed here
The collection link template points at a route name (entity.domain.collection) that the module does not declare, so $domain->toUrl('collection') throws a RouteNotFoundException. The actual route is domain.admin. Pre-existing and unrelated, so it is left for a separate issue.