feat: design-system filters and global module ids in node-get/outline (S19)
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:
@@ -85,6 +85,7 @@ final class DiviNodeGetAbility implements Ability
|
||||
],
|
||||
'builder_version' => ['type' => ['string', 'null']],
|
||||
'children' => ['type' => 'array', 'items' => ['type' => 'string']],
|
||||
'global' => ['type' => ['object', 'null']],
|
||||
],
|
||||
'required' => ['post_id', 'tree_rev', 'rev', 'id', 'type', 'editable', 'attrs', 'shortform', 'children'],
|
||||
];
|
||||
@@ -128,6 +129,16 @@ final class DiviNodeGetAbility implements Ability
|
||||
$editable = $block->isDivi() && ! $block->isOpaque();
|
||||
$version = $block->attrs()['builderVersion'] ?? null;
|
||||
|
||||
$global = NodeSummary::globalRef($block);
|
||||
if ($global !== null) {
|
||||
$global['hint'] = sprintf(
|
||||
'Globales Modul: Inhalt im Bibliothekseintrag %s bearbeiten (lit-divi-outline mit post_id %s); '
|
||||
. 'jede Änderung dort wirkt auf alle Seiten mit diesem Modul.',
|
||||
$global['id'],
|
||||
$global['id']
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
'post_id' => (int) $page->post->ID,
|
||||
'tree_rev' => $page->treeRev(),
|
||||
@@ -147,6 +158,7 @@ final class DiviNodeGetAbility implements Ability
|
||||
'children' => $editable
|
||||
? array_values(array_filter(array_map([$page->index, 'idOf'], $block->children())))
|
||||
: [],
|
||||
'global' => $global,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,10 +98,14 @@ final class DiviOutlineAbility implements Ability
|
||||
'type' => 'boolean',
|
||||
'description' => 'Weitere Kinder dieses Knotens wurden wegen "limit" abgeschnitten.',
|
||||
],
|
||||
'global_id' => [
|
||||
'type' => ['string', 'null'],
|
||||
'description' => 'Bibliotheks-ID eines globalen Moduls.',
|
||||
],
|
||||
],
|
||||
'required' => [
|
||||
'id', 'type', 'label', 'excerpt', 'info', 'presets', 'children', 'editable', 'depth',
|
||||
'truncated',
|
||||
'truncated', 'global_id',
|
||||
],
|
||||
],
|
||||
],
|
||||
@@ -187,7 +191,8 @@ final class DiviOutlineAbility implements Ability
|
||||
|
||||
if (in_array(false, array_column($rows, 'editable'), true)) {
|
||||
$hints[] = 'Knoten mit "nur lesbar" (globale Module, fremde Blöcke) lassen sich nur als Ganzes '
|
||||
. 'verschieben, duplizieren oder löschen; ihren Inhalt im Divi-Builder bearbeiten.';
|
||||
. 'verschieben, duplizieren oder löschen. Globale Module [global <ID>] im Bibliothekseintrag '
|
||||
. 'bearbeiten: lit-divi-outline mit post_id <ID> – die Änderung wirkt auf alle Seiten.';
|
||||
}
|
||||
|
||||
return $hints;
|
||||
|
||||
Reference in New Issue
Block a user