From b8954be7eb99a19b656e231a28923959972ef941 Mon Sep 17 00:00:00 2001 From: Pascal Martineau Date: Wed, 24 Sep 2025 10:55:49 -0400 Subject: [PATCH] wip: pass preview data --- .../themes/ccat/acf-json/group_abstract_builder.json | 6 ++---- wp-content/themes/ccat/layouts/preview.php | 12 +++++++++--- .../themes/ccat/server/api/acf-preview.post.ts | 4 +++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/wp-content/themes/ccat/acf-json/group_abstract_builder.json b/wp-content/themes/ccat/acf-json/group_abstract_builder.json index e11d276..2785fe4 100644 --- a/wp-content/themes/ccat/acf-json/group_abstract_builder.json +++ b/wp-content/themes/ccat/acf-json/group_abstract_builder.json @@ -33,9 +33,7 @@ "toggle", "copy" ], - "acfe_flexible_remove_button": [ - "add" - ], + "acfe_flexible_remove_button": [], "acfe_flexible_modal_edit": { "acfe_flexible_modal_edit_enabled": "1", "acfe_flexible_modal_edit_size": "xlarge" @@ -161,5 +159,5 @@ "graphql_types": "", "acfe_meta": "", "acfe_note": "", - "modified": 1758715372 + "modified": 1758719135 } diff --git a/wp-content/themes/ccat/layouts/preview.php b/wp-content/themes/ccat/layouts/preview.php index 53b5b66..84b7d79 100644 --- a/wp-content/themes/ccat/layouts/preview.php +++ b/wp-content/themes/ccat/layouts/preview.php @@ -1,5 +1,11 @@ 'POST' ) ); -?> -
+$data = array( + 'layout' => get_row_layout(), +); +$result = wp_remote_post( $preview_url, array( 'body' => $data ) ); +if ( is_wp_error( $result ) ) { + echo '
Erreur: ' . esc_html( $result->get_error_message() ) . '
'; +} else { + echo $result['body']; +} diff --git a/wp-content/themes/ccat/server/api/acf-preview.post.ts b/wp-content/themes/ccat/server/api/acf-preview.post.ts index 7187eea..502ad5e 100644 --- a/wp-content/themes/ccat/server/api/acf-preview.post.ts +++ b/wp-content/themes/ccat/server/api/acf-preview.post.ts @@ -1,3 +1,5 @@ -export default defineEventHandler(() => { +export default defineEventHandler(async (event) => { + const body = await readBody(event); + console.log(body); return `
TODO: Preview from Nuxt API endpoint
`; });