fix: Task 1 review round 2 - custom CSS builder-only, no settings on gvid/font references

S26: every css.* path is gated like S7 for users without unfiltered_html.
S27: Divi ignores settings on global variable and theme font references,
so any settings there are rejected.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 13:39:36 +02:00
co-authored by Claude Opus 5.5
parent 7180690611
commit eb99b360b4
4 changed files with 34 additions and 6 deletions
+4 -3
View File
@@ -35,10 +35,11 @@ final class AttrWriter
private const URL_SEGMENT = '/url$/i';
/**
* Raw HTML/CSS fields, and the ones Divi re-serializes whole pages for (ruling S7), at any
* depth: module.advanced.html, module.advanced.html.htmlBefore, css.advanced.customCss.
* Raw HTML/CSS fields, and the ones Divi re-serializes whole pages for (rulings S7/S26), by
* path shape at any depth: module.advanced.html(.htmlBefore), module.decoration.attributes,
* any free-form custom CSS path of any module (css, css.*, title.css.*, css.advanced.customCss).
*/
private const BUILDER_ONLY = '/(^|\.)(decoration\.attributes|advanced\.html|advanced\.customCss)(\.|$)/';
private const BUILDER_ONLY = '/(^|\.)(decoration\.attributes|advanced\.html|advanced\.customCss|css)(\.|$)/';
public function __construct(
private ModuleCatalog $catalog,
@@ -22,7 +22,7 @@ use stdClass;
* Allowed names:
* - type "color": a global color ID of the design system or a global variable of type "colors";
* settings hue/saturation/lightness/opacity, numbers only.
* - type "content": a non-color global variable or a theme font (settings DESIGN_SETTINGS);
* - type "content": a non-color global variable or a theme font (no settings, DESIGN_SETTINGS, S27);
* custom_meta_<key> with META_KEY (no leading "_", ruling S12; settings from the map entry of
* that exact name, else META_SETTINGS); or a key of the dynamic content map.
*
@@ -59,8 +59,13 @@ final class VariableRef
/** Settings of custom_meta_<key> without a map entry of its own. */
public const META_SETTINGS = self::BEFORE_AFTER;
/** Settings of content references to global variables and theme fonts. */
public const DESIGN_SETTINGS = self::BEFORE_AFTER;
/**
* Settings of content references to global variables and theme fonts: none (ruling S27).
* Divi ignores them: theme fonts resolve to var(<name>) (DynamicData.php:300), and the gvid
* option "doesn't have any settings" and renders without them
* (DynamicContentGlobalVariableOptions.php:66-69, 155-161).
*/
public const DESIGN_SETTINGS = [];
private const BEFORE_AFTER = ['before' => 'richtext', 'after' => 'richtext'];