feat: Divi tools edit Theme Builder layouts; visible layouts need confirm

TB layouts load through ThemeBuilderAccess (P12), live layouts (attached +
enabled, Q8) need a dry run and confirm (Q9) and get the shared restore point
of VisibleEdits, extracted from GlobalEdits (Q2: backup when revisions are
off, P9 refusals, P14 naming). divi/post-content only in body layouts (F22),
also for nested stored nodes. SaveScope::ThemeBuilderLayout sets Divi flags
and clears site CSS + TB cache.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 15:45:07 +02:00
co-authored by Claude Opus 5.5
parent 4ff1c1e2a5
commit b1dd35abd8
27 changed files with 1106 additions and 132 deletions
@@ -36,6 +36,7 @@ defined('ABSPATH') || exit;
class DiviComposition
{
private ?int $postId = null;
private ?string $themeBuilderArea = null;
private ?VariableRef $references = null;
private ?Placeholders $placeholders = null;
private ?ValueCleaner $cleaner = null;
@@ -52,11 +53,12 @@ class DiviComposition
) {
}
/** A fresh composition for entry $postId (own VariableRef with that entry's live map). */
public function forPost(int $postId): static
/** A fresh composition for entry $postId (own VariableRef with its live map; TB area for StructureRules). */
public function forPost(int $postId, ?string $themeBuilderArea = null): static
{
$bound = clone $this;
$bound->postId = $postId;
$bound->themeBuilderArea = $themeBuilderArea;
$bound->references = null;
$bound->placeholders = null;
$bound->cleaner = null;
@@ -116,7 +118,7 @@ class DiviComposition
/** @internal Public for tests; code uses composer() / editor(). */
public function rules(): StructureRules
{
return new StructureRules($this->modules->catalog());
return new StructureRules($this->modules->catalog(), $this->themeBuilderArea);
}
/** E6: the check for stored nodes that move into this composition's entry (same cleaner and references). */