Contexts, Layout Variants, and Builder Types
Supported contexts
pageformmailpdfpartial(internal/core support)
Builder mapping
- Page builder ->
context=page,layout_variant=default - Slider builder ->
context=page,layout_variant=carousel - Form builder ->
context=form - Mail builder ->
context=mail - PDF builder ->
context=pdf
A slider is not a separate context. It is a page context with a different layout variant.
Canvas resolution concept
Depending on context and variant, different canvas payload defaults are used.
This affects:
- available modules
- default body props
- preview behavior
Module availability
Each module declares its allowed contexts via ModuleDefinition::contexts([...]) (or by overriding getContexts()). Modules without an explicit declaration default to ['page'].
Filtering is automatic at bootstrap time. The core service calls ComponentRegistry::forContext($context) and returns only the modules eligible for the requested context. Unavailable modules simply do not appear in the availableComponents payload — there is no client-side branching to write.
Example: in context=mail, modules like Video, Tabs, Accordion, Slider, and Popup are typically excluded because their interactive or media-heavy behavior is not safe in email clients. Their PHP classes declare getContexts() accordingly, and the builder palette reflects that automatically.
When you author a custom module:
- declare
contexts(['form'])for form-only fields - declare
contexts(['page', 'mail', 'pdf'])for cross-context content - omit
contexts(...)for page-only defaults
If a module accidentally appears or disappears in a context, check its declared contexts before looking elsewhere — the bootstrap response is the single source of truth for the editor palette.
Practical guidance
When creating custom modules:
- Define contexts explicitly.
- Test in all enabled contexts.
- Validate behavior for carousel variant when relevant.
Common mistakes
- Assuming popup is a context (it is a page module).
- Assuming slider uses
context=slider(it does not). - Saving without variant awareness and then previewing in wrong mode.
- Assuming page layout fallback is all-or-nothing. Header and footer can resolve from different layouts.