diff --git a/wp-content/themes/ccat/includes/vendors/acf.php b/wp-content/themes/ccat/includes/vendors/acf.php index 66cedc8..ba23cea 100644 --- a/wp-content/themes/ccat/includes/vendors/acf.php +++ b/wp-content/themes/ccat/includes/vendors/acf.php @@ -1,5 +1,12 @@ ccat_get_graphql_field_group_name( 'group_abstract_builder', $layout_name ), + ); + foreach ( get_row( true ) as $key => $value ) { + if ( strpos( $key, 'acf_fc_layout' ) !== 0 && strpos( $key, '_' ) !== 0 ) { + $result[ ccat_get_graphql_field_name( array( 'name' => $key ) ) ] = $value; } } - - // Fallback to raw data if no config - if ( ! $layout_config || ! isset( $layout_config['sub_fields'] ) ) { - $raw_data = get_row( true ); - $result = array(); - foreach ( $raw_data as $key => $value ) { - if ( strpos( $key, 'acf_fc_layout' ) !== 0 && strpos( $key, '_' ) !== 0 ) { - $result[ ccat_get_graphql_field_name( array( 'name' => $key ) ) ] = $value; - } - } - return $result; - } - - // Process fields with proper ACF access - $result = array(); - foreach ( $layout_config['sub_fields'] as $field ) { - $key = ccat_get_graphql_field_name( $field ); - if ( $field['type'] === 'repeater' && $field['name'] === 'layout_settings' ) { - if ( have_rows( 'layout_settings' ) ) { - the_row(); - $result[ $key ] = ccat_get_graphql_fields_value( $field['sub_fields'], get_row( true ) ); - wp_reset_postdata(); - } - } else { - $value = get_sub_field( $field['name'] ); - $result[ $key ] = isset( $field['sub_fields'] ) && $value - ? ccat_get_graphql_fields_value( $field['sub_fields'], $value ) - : $value; - } - } - return $result; } - -// Google Maps API key -add_filter( 'acf/fields/google_map/api', 'ccat_acf_google_map_api' ); -function ccat_acf_google_map_api( $api ) { - $api['key'] = 'AIzaSyCoB9_Um059jyenVcFfpXTBq-zZAxlBPqk'; - return $api; -} diff --git a/wp-content/themes/ccat/layouts/preview.php b/wp-content/themes/ccat/layouts/preview.php index 95d0109..41625c0 100644 --- a/wp-content/themes/ccat/layouts/preview.php +++ b/wp-content/themes/ccat/layouts/preview.php @@ -1,9 +1,6 @@ get_row_layout(), - 'value' => ccat_get_graphql_row_value(), -); +$preview_url = ( defined( 'NUXT_PUBLIC_SITE_URL' ) ? NUXT_PUBLIC_SITE_URL : 'https://cultureat.ca' ) . '/api/preview'; +$data = ccat_get_graphql_preview_data(); $result = wp_remote_post( $preview_url, array( 'body' => $data ) ); if ( is_wp_error( $result ) ) { echo '