Extensibility

Features are self-contained, yet your product still needs to change them. These mechanisms let one feature add to or replace the services, templates, models, hooks and routes of another without forking it. Start with Refine, extend or compose, which tells you which one to reach for first.

Page What it covers
Refine, extend or compose The decision rule. Compose first, extend when you need the base’s data, refine last
Template hooks Named slots in templates that features fill with HTML callbacks
Refinement A feature that overrides services, templates or hooks of another, extends its models or adds routes
Admin resources A registry where a feature describes how its model appears in the admin panel
Service locator Replaceable service classes, resolved at request time
Service interfaces An interface a concrete parent declares and its providers implement, one of an alternative group or several of an or-group
Extension points What a feature declares safe to override
Validation The checks that stop invalid or colliding refinements, at startup and before it

Quick reference

Mechanism When to use Example
Template hook (register) A feature adds UI to a slot notes registers layout.sidebar.authenticated.items
Template hook (replace) A refiner replaces what its base puts in a slot. Other features’ callbacks stay shop_coupons replacing layout.navbar.authenticated in Refinement
Inter-feature hook A feature adds UI to another feature’s template shop fills home.section on the homepage of a home feature
Service locator A refiner swaps business logic notes_tags overriding NotesService in Refinement
Template override A refiner replaces a page template shop_coupons overriding shop/checkout_form.html in Refinement
Model extension A refiner adds columns or methods to a model collections adds collection_id to Item
Route addition A refiner adds endpoints to a base blueprint shop_coupons adding /checkout/coupon in Refinement
Signal React to domain events across features, with no override notes emits note-created, and a listener uses connect_signal

Table of contents


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es