Install

Works with Drupal: ^10 || ^11

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 11.48 KB
MD5: 0e2c4ad4259d4d55f08b92426dbc3c4f
SHA-1: a3635d769a0daece9087f461b979d43fc9f1bfb0
SHA-256: e271e6ba4e796b15beda56ac11daa79a4f88b7a4b944c7fbdb27e1740b221e9c
Download zip 13.18 KB
MD5: 24ff53a30b4d2a6cbbcac7d2539ecac6
SHA-1: 99dd63b3458a9e6524ab8cfe002dd23991a2cba0
SHA-256: 17fda6131405a333eab53750e90c43ebfa9c5c5a639519fa4b243c4f86d57927

Release notes

## Overview

SDC Property Inheritance is a Drupal module that provides runtime inheritance for Single Directory Components (SDC). It allows replacement components (using `replaces:`) to omit their `props` schema, automatically inheriting the parent schema and avoiding duplication, while remaining fully compatible with Drupal core validation.

## Features

- **Automatic Prop Inheritance:**
- Replacement components can omit the `props` block; the parent component's schema is injected at runtime.
- Partial overrides are supported: only missing properties are merged in, and your overrides take precedence.
- New props in the child are always set to `required: false` for compatibility.
- **Library Overrides:**
- Inherits `libraryOverrides` from the parent if not defined in the child.
- **Compatibility Checks:**
- Ensures that child schemas cannot be stricter than the parent.
- Throws clear errors if replacement schemas are incompatible.
- **Debugging:**
- Adds a `_inherited` marker to merged definitions for easy verification.
- **Performance:**
- Inheritance logic runs once per discovery cache rebuild; results are cached for efficiency.

## Usage

- Place only metadata and `replaces:` in your override component if you only need to change Twig/CSS.
- For partial overrides, declare only the properties you want to override; the rest are inherited.
- See the README for full usage patterns and debugging tips.

## Limitations

- Does not attempt deep merging of nested `properties` schemas beyond one level.
- Only `props` and `libraryOverrides` are considered; slots are not modified.
- If the parent removes or renames a prop, children reflect that on the next cache rebuild.
- The debug key `_inherited` is internal and should not be used in production logic.

---
**In short:** Place only metadata + `replaces:` in your override component if all you need is Twig/CSS changes; this module lifts the parent schema in at runtime so core stays happy.

Created by: aaronchristian
Created on: 7 Feb 2026 at 21:39 UTC
Last updated: 7 Feb 2026 at 21:39 UTC
Bug fixes
New features

Other releases