fix: name the WordPress revision screen for library and layout revisions (audit L3)

lit/revision-restore takes only content types, so a write to a library entry
or a Theme Builder layout now answers with restore_url (wp-admin
revision.php for its revision_id), also per page in lit/divi-replace-text.
The guides and readme no longer present lit/revision-restore as the way back
for these types.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-27 23:05:05 +02:00
co-authored by Claude Opus 5.5
parent 79f2fdbda6
commit dcae2d4b91
11 changed files with 48 additions and 12 deletions
@@ -155,10 +155,28 @@ final class DiviWriter
foreach ($change->entries() as $entry) {
$tool->changed(DiviChange::idOf($entry, $index) ?? '?', $entry['type'], $entry['action'], $entry['label']);
}
$restore = self::restoreUrl($page, $saved['revision_id']);
if ($restore !== null) {
$tool->with('restore_url', $restore);
}
return $tool->toArray();
}
/**
* Audit L3: lit/revision-restore takes only the content types (ContentSchema) – not library entries or Theme
* Builder layouts. Their revision is restored in WordPress' revision screen; null for everything else.
*/
private static function restoreUrl(DiviPage $page, mixed $revisionId): ?string
{
$noRestoreTool = $page->isLibraryItem() || $page->isThemeBuilderLayout();
if (! $noRestoreTool || ! is_int($revisionId) || $revisionId <= 0) {
return null;
}
return admin_url('revision.php?revision=' . $revisionId);
}
/**
* save() for the Divi tools (E2): pages as before; a library entry keeps its shape, a global one
* needs confirm (dry run first), gets a backup when revisions are off and clears every page's