Reusable Blocks, Presets & Defaults
Blocks separates shared content (Reusable Blocks), visual design templates (Block Presets), and project-wide baseline settings (Block Defaults) so teams never confuse structural reuse with styling reuse.
Reusable Blocks (blocks-reusable)
Section titled “Reusable Blocks (blocks-reusable)”Create centrally authored block compositions under Setup > Blocks > Reusable Blocks and insert them across pages and layouts as locked blocks_reusable_ref pointers:
- Cycle Prevention (
ReusableCycleValidator): Blocks recursive or deeply nested Reusable references beyondMAX_DEPTH = 8. - Delete Usage Guard (
ReusableManager::assertCanDelete()): Prevents deleting any Reusable Block still referenced by non-trashed Pages, Layouts, or other Reusables, and displays live usage links inReusableUsageBanner. - Detach to Editable Copy (
detachReference()): Editors can detach any placed Reusable reference into independent editable blocks (safely cloning attached media files with fresh UUIDs). - Per-Page Content Overrides (
allow_overrides): Enable Allow Overrides on a Reusable Block so editors can override eligibleContent-tab fields per placement (discoverOverridableSlots()/sanitizeOverrides()) while keeping layout and visual settings centrally locked.
Block Presets (blocks-presets)
Section titled “Block Presets (blocks-presets)”Define reusable visual configurations and starter content for any presettable target_block under Setup > Blocks > Presets:
SnapshotMode: Copies the Preset’sSettingsand starterContentonto the block at insertion time (PresetManager::applySnapshot()); subsequent edits are completely local.LinkedMode: Syncs the Preset’s visualSettingscentrally on every render (PresetManager::resolveEffectiveValues()) while preserving each page’s localContent.- Visual Configurator & Live Preview: The Preset editor embeds
PresetValuesConfigurator(3-state boolean controls, tab-only grouping, Visual Settings, Starter Content, and Advanced JSON) alongsidePresetLivePreviewPanelfor real-time responsive preview. Revision inspection enforcesPresetManager::canViewRevisions()to protect restricted fields.
Project-Wide Block Defaults (blocks-defaults)
Section titled “Project-Wide Block Defaults (blocks-defaults)”Configure a 1:1 baseline default record per target_block under Setup > Blocks > Defaults:
- Cached in
WireCache(Blocks.DefaultsMap) with zero runtime SQL queries. - Automatically seeds newly created blocks (
$blocks->createBlock($type)and editor insertions) with configuredSettingsand eligibleContentdefaults without overwriting explicit values. - One-Shot
apply_to_existing: Optionally check Apply to Existing Blocks on save to update configuredSettingsand fill only unset/emptyContentkeys across existing non-linkedblocks in a single database transaction (populated editorial content is never overwritten).