Downloads
Download tar.gz
97.9 KB
MD5: a115857f264fb8f3732f021630f4d065
SHA-1: fd9e75f0a4924e9d3bc3ae254aaa891a5fcc1c53
SHA-256: 9e1581538b66cb94f24cc068415539812761e4607e0880d29ecd3816580707b0
Download zip
157.45 KB
MD5: 948a1e639f69b0e04d22b54eb96f2e66
SHA-1: 7c710a680c340c5ce5b9927bce42a0e27200da77
SHA-256: d53806e9e1bc81baa42d016f2992f369db244d13d81bfb53519879c7399f6788
Release notes
SDX Engine replaces Drupal's Twig rendering with a structured data pipeline. Instead of producing HTML strings, the theme engine outputs typed JSON that JavaScript framework components consume directly. All rendering goes through a single structured path: no fallbacks, no DOM parsing, no HTML markers.
Core Architecture
Structured Token Rendering
- Self-contained tokens (
__SDX{base64json}SDX__) embed component ID and props directly in the token string - Tokens survive Drupal's render cache without side-channel state
- PageRenderer resolves tokens server-side into
ComponentNode[]arrays - Client receives clean JSON. Zero client-side DOM parsing
RenderContext
- Manages structured mode state for the rendering pipeline
pushComponent()creates tokens with embedded data- Re-entrant safe via depth counter
resetStructuredMode()prevents cross-request state leaks in PHP-FPM
SdxThemeEngine
- Implements Drupal's
PhpTemplateEnginecontract - Resolves
.tsx,.vue,.sveltetemplates for any Drupal theme hook - Template auto-discovery:
templates/block/block.tsx,templates/form-element/form-element.tsx, etc. - Scans themes, base themes, and enabled modules for template overrides
Region-Level Partial Reloads
- Per-region cache tag checksums computed during rendering
- Checksums included in page response as
_regionChecksums - On SPA navigation, server compares client checksums with current state
- Only re-renders and sends regions whose cache tags changed
- Unchanged regions preserved client-side
AJAX Structured Data
AjaxStructuredResponseSubscriberresolves tokens in AJAX dialog responses- Forms opened in modals get structured data, not HTML strings
- Runs at RESPONSE priority -101 (after Drupal's AjaxResponseSubscriber)
DataProvider Plugin System (sdx_data_provider submodule)
- PHP 8 attribute-based plugin discovery (
#[SdxDataProvider]) - Route-level typed data with prop priorities:
Prop::IMMEDIATE,Prop::DEFERRED,Prop::LAZY - Persistent layouts via
getLayout()for preserving UI state across navigations - Partial prop updates via
_partialflag - CSRF token injection for form submissions
- Contextual links resolution
Included DataProviders:
- AdminOverview, Announcements, Appearance (theme management)
- BlockLayout, ConfigPage, ContentTypeEdit
- EntityList, FieldList, FieldUI
- HelpPage, MenuEditor, Permissions
- StatusReport, ViewsEdit, ViewsPage, ViewsList
Serialization Services
- VariableSerializer: converts Drupal render arrays and template variables to typed JSON
- FormRenderSerializer: structured form serialization with per-element-type handlers (select, textarea, boolean, file, table, etc.)
- EntityFieldSerializer: entity field data extraction
- RenderArraySerializer: universal typed JSON for any Drupal render array
- NativeHtmlRenderer: renders standard Drupal elements (pagers, tables) to HTML for framework consumption
- PageDataExtractor: breadcrumb, tabs, actions, messages extraction