diff --git a/.claude/TASKS.md b/.claude/TASKS.md index 5f375ed..1e479b2 100644 --- a/.claude/TASKS.md +++ b/.claude/TASKS.md @@ -149,10 +149,11 @@ Use GitHub-style checkboxes to mark task completion: ### ACF Extended Pro Preview System - [x] Configure ACF Extended Pro preview templates -- [ ] Set up iframe preview system -- [ ] Implement SSR rendering for preview content +- [x] Set up iframe preview system +- [x] Implement SSR rendering for preview content - [x] Create preview layouts in `/layouts` directory -- [ ] Test real-time preview functionality +- [x] Implement reusable template replacement logic +- [x] Test real-time preview functionality ### Content Features - [ ] Implement image uploads with point-of-interest cropping diff --git a/wp-content/themes/ccat/acf-json/acf-translations.php b/wp-content/themes/ccat/acf-json/acf-translations.php index ddce023..41f8c99 100644 --- a/wp-content/themes/ccat/acf-json/acf-translations.php +++ b/wp-content/themes/ccat/acf-json/acf-translations.php @@ -146,6 +146,7 @@ __( "Start date / time", 'ccat' ); __( "Start month", 'ccat' ); __( "Subject", 'ccat' ); __( "Target audience", 'ccat' ); +__( "Template", 'ccat' ); __( "Term – Discipline", 'ccat' ); __( "Text block", 'ccat' ); __( "This event is asynchronous", 'ccat' ); 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 9c7b653..e5c6363 100644 --- a/wp-content/themes/ccat/acf-json/group_abstract_builder.json +++ b/wp-content/themes/ccat/acf-json/group_abstract_builder.json @@ -116,6 +116,68 @@ "acfe_flexible_category": false, "acfe_layout_col": "auto", "acfe_layout_allowed_col": false + }, + "layout_68d559a93813a": { + "key": "layout_68d559a93813a", + "name": "template", + "label": "Template", + "display": "block", + "sub_fields": [ + { + "key": "field_template_id", + "label": "Template", + "name": "template", + "aria-label": "", + "type": "post_object", + "instructions": "", + "required": 1, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "post_type": [ + "template" + ], + "post_status": "", + "taxonomy": "", + "return_format": "id", + "multiple": 0, + "max": "", + "save_custom": 0, + "save_post_status": "publish", + "acfe_add_post": 0, + "acfe_edit_post": 0, + "acfe_bidirectional": { + "acfe_bidirectional_enabled": "0" + }, + "allow_null": 0, + "allow_in_bindings": 0, + "bidirectional": 0, + "show_in_graphql": 1, + "graphql_description": "", + "graphql_field_name": "template", + "graphql_connection_type": "one_to_many", + "ui": 1, + "bidirectional_target": [], + "save_post_type": "", + "min": "" + } + ], + "min": "", + "max": "", + "acfe_flexible_render_template": "", + "acfe_flexible_render_style": "", + "acfe_flexible_render_script": "", + "acfe_flexible_modal_edit_size": "", + "acfe_flexible_settings": "", + "acfe_flexible_settings_size": "large", + "acfe_flexible_thumbnail": false, + "acfe_layout_locations": [], + "acfe_flexible_category": false, + "acfe_layout_col": "auto", + "acfe_layout_allowed_col": false } }, "min": "", @@ -159,5 +221,5 @@ "graphql_types": "", "acfe_meta": "", "acfe_note": "", - "modified": 1758740869 + "modified": 1758814061 } diff --git a/wp-content/themes/ccat/functions.php b/wp-content/themes/ccat/functions.php index 351af56..0fb93df 100644 --- a/wp-content/themes/ccat/functions.php +++ b/wp-content/themes/ccat/functions.php @@ -3,6 +3,7 @@ // Administration // Core +require_once __DIR__ . '/includes/core/sections.php'; require_once __DIR__ . '/includes/core/theme-setup.php'; // Custom Post Types diff --git a/wp-content/themes/ccat/includes/core/sections.php b/wp-content/themes/ccat/includes/core/sections.php new file mode 100644 index 0000000..633acfe --- /dev/null +++ b/wp-content/themes/ccat/includes/core/sections.php @@ -0,0 +1,45 @@ + ccat_get_graphql_field_group_name( 'group_abstract_builder', $layout_name ), ); - foreach ( get_row( true ) as $key => $value ) { + $format_value = $result['fieldGroupName'] !== 'GroupAbstractBuilderSectionsTemplateLayout'; + foreach ( get_row( $format_value ) ?: array() as $key => $value ) { if ( strpos( $key, 'acf_fc_layout' ) !== 0 && strpos( $key, '_' ) !== 0 ) { $result[ ccat_get_graphql_field_name( array( 'name' => $key ) ) ] = $value; } diff --git a/wp-content/themes/ccat/layouts/preview.php b/wp-content/themes/ccat/layouts/preview.php index 41625c0..1c9a316 100644 --- a/wp-content/themes/ccat/layouts/preview.php +++ b/wp-content/themes/ccat/layouts/preview.php @@ -1,7 +1,11 @@ $data ) ); +if ( $data['fieldGroupName'] === 'GroupAbstractBuilderSectionsTemplateLayout' ) { + echo '
' . get_the_title( $data['fieldTemplateId'] ) . '
'; + return; +} +$result = wp_remote_post( $preview_url, array( 'body' => $data ) ); if ( is_wp_error( $result ) ) { echo '
Erreur: ' . esc_html( $result->get_error_message() ) . '
'; } else {