Install

Works with Drupal: ^10.3 || ^11 || ^12

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 29.18 KB
MD5: 8d89266e6d50dc5fcde9f8aebefea6df
SHA-1: 9f77c80ae04f28b957985b9645aa4862cc43a561
SHA-256: ceb0ff326a1726ddc2b442a94ce55e0233aef69e288f8cdddae3f17a6d3db981
Download zip 53.78 KB
MD5: de0111fb159fb3352af4342cbdeb3656
SHA-1: e3c12ec76ff6c96573e00ee4c4fd1a06919c0a7a
SHA-256: 7675e1092b0a84dce2fe3e294883defd386ebdc184338caa671014f7b4dea3de

Release notes

Child Entity 2.1.0 modernizes the module for Drupal 10.3+, Drupal 11, and Drupal 12 with PHP 8.4+ strict typing, OOP hooks, dedicated HTML and revision route providers, multi-level hierarchy fixes, and a comprehensive kernel and functional test suite.

Highlights & New Features

  • Drupal 11 & 12 / PHP 8.4 Modernization:
    • Updated core compatibility to ^10.3 || ^11 || ^12 and minimum PHP requirement to >=8.4.
    • Enforced declare(strict_types=1); and native parameter, property, and return type hints across the entire module.
    • Migrated procedural hooks (hook_entity_presave(), hook_entity_type_alter()) to an OOP hook class (Drupal\child_entity\Hook\ChildEntityHooks) using #[Hook] attributes, with #[LegacyHook] procedural shims in child_entity.module for backward compatibility.
  • Dedicated Route Providers & Revision Support:
    • Added ChildDefaultHtmlRouteProvider, ChildAdminHtmlRouteProvider, and ChildRevisionHtmlRouteProvider (for revision history, view, revert, and delete routes prefixed with parent parameters).
    • Extracted shared route preparation and parent parameter upcasting logic into ChildEntityRouteProviderTrait.
    • Added ChildEntityHelper for static entity type validation (validateChildEntityType(), isChildEntityType()) without triggering PHP 8.4/8.5 static trait call deprecations.
  • Data Integrity & Form Enforcement:
    • hook_entity_presave() now attempts to recover a missing parent reference from the active route match before throwing a \LogicException if a child entity is saved without a parent.
    • hook_entity_type_alter() validates that non-confirm content entity forms (default, add, edit) on child entities extend ChildContentEntityForm.
    • Marked the parent entity_reference base field in ChildEntityTrait::childBaseFieldDefinitions() as required and revisionable (when the child entity type is revisionable).
  • Automated Test Suite:
    • Added the child_entity_test test module and automated PHPUnit Kernel and Functional tests covering 2-level and 3-level entity hierarchies, routing, route contexts, access delegation, dynamic permissions, presave integrity, and UI workflows.

Bug Fixes

  • Fixed multi-level parent parameter recursion: Fixed infinite recursion in ChildEntityTrait::buildParentParams() and updated ChildEntityController::addPage() to walk the full ancestor chain when building bundle add links and single-bundle redirects.
  • Fixed route context resolution: Fixed ChildEntityRouteContext::getRuntimeContexts() key mismatches between child and parent entity type IDs and registered ChildEntityRouteSubscriber in child_entity.services.yml.
  • Fixed bundle & revision permission generation: Fixed bundle key iteration in ChildEntityPermissions::generatePermissions() and restricted revision permissions to revisionable child entity types.
  • Fixed bundle-less add-form route errors: Guarded ChildEntityController::addPage() when a bundle config entity type does not define an add-form link template.

API Changes & Deprecations

  • ChildEntityInterface now explicitly extends Drupal\Core\Entity\ContentEntityInterface, allows nullable returns on getParentEntity(): ?EntityInterface and getParentId(): int|string|null, and uses : static return types on setParentId() and setParentEntity().
  • ChildContentEntityHtmlRouteProvider is deprecated in child_entity:2.1.0 and will be removed in child_entity:3.0.0. Use Drupal\child_entity\Routing\ChildAdminHtmlRouteProvider or Drupal\child_entity\Routing\ChildDefaultHtmlRouteProvider instead.
Created by: dwkitchen
Created on: 14 Nov 2026 at 11:28 UTC
Last updated: 14 Nov 2026 at 11:29 UTC
Bug fixes
New features

Other releases