Content sources
Each document declares a source in config/legal-consent.php:
markdown(default) — git-diffable, PR-reviewable.mdfiles underresources/legal.drafts— the admin-maintained draft store. Texts are authored and reviewed per locale in your own screens, and only a reviewed draft set can be released. Opt a document in with'source' => 'drafts'. See Managing legal texts.
Any other value is your own class implementing Pushery\LegalConsent\Content\LegalDocumentSource,
named as the source's driver and resolved from the container. The registry it is named in is
sources in config/legal-consent.php, and a document points at an entry by its key:
// config/legal-consent.php
'sources' => [
'markdown' => ['driver' => MarkdownFilesDriver::class, 'path' => null],
'drafts' => ['driver' => DraftDocumentSource::class],
// Yours. The key is what a document's `source` names.
'cms' => ['driver' => \App\Legal\CmsDocumentSource::class],
],
'documents' => [
'terms' => ['source' => 'cms', /* … */],
],
Anything else in the entry is handed to the driver, so a source that needs its own settings takes
them there — markdown does exactly that with path.
A custom source is also the operator-identity seam
A custom source is the seam for interpolating operator identity (Impressum, Art. 13 contact,
VAT id, jurisdiction) from a single config source at render time: render your own Blade or HTML
with the values filled in and return it as an Html-format body — the pipeline hashes exactly
what you rendered, so the acceptance proof still covers precisely what the subject saw.
Two rules keep it safe:
- Pin the
$localeyou are handed. A source that calls__()on the ambient locale hashes the same text differently per viewer and makeslegal-consent:check-driftflap. - Give every document a real
MAJOR.MINOR.PATCHversion. A null version defaults to0.0.0, which can never gate (the gate compares major versions, andheld >= 0is always true), so always set one on a gating document.