diff --git a/wp-content/themes/twentytwentyfour/assets/css/test1-shared-shell.css b/wp-content/themes/twentytwentyfour/assets/css/test1-shared-shell.css index 749f27af..28ba0efc 100644 --- a/wp-content/themes/twentytwentyfour/assets/css/test1-shared-shell.css +++ b/wp-content/themes/twentytwentyfour/assets/css/test1-shared-shell.css @@ -2,6 +2,81 @@ font-family: "Manrope", sans-serif; } +.test1-shared-privacy-page .privacy-policy-section { + padding-top: 72px; +} + +.test1-shared-privacy-page .privacy-policy-content { + max-width: 980px; + margin: 0 auto; +} + +.test1-shared-privacy-page .privacy-policy-content p { + margin: 0 0 18px; + color: #1f2937; + line-height: 1.7; +} + +.personal-data-consent { + display: flex; + align-items: flex-start; + gap: 10px; + margin: 2px 0 14px; + color: #374151; + font-size: 13px; + line-height: 1.45; +} + +.personal-data-consent input { + flex: 0 0 auto; + width: auto; + margin-top: 3px; +} + +.cookie-consent-banner { + position: fixed; + right: 24px; + bottom: 24px; + z-index: 9999; + display: flex; + align-items: center; + gap: 18px; + max-width: 760px; + padding: 18px 20px; + background: #fff; + border: 1px solid rgba(15, 23, 42, 0.14); + box-shadow: 0 18px 50px rgba(15, 23, 42, 0.2); +} + +.cookie-consent-banner[hidden] { + display: none; +} + +.cookie-consent-banner p { + margin: 0; + color: #1f2937; + line-height: 1.45; +} + +.cookie-consent-accept { + flex: 0 0 auto; + padding: 10px 20px; + border: 0; + background: #0f766e; + color: #fff; + font-weight: 700; +} + +@media (max-width: 767px) { + .cookie-consent-banner { + right: 12px; + bottom: 12px; + left: 12px; + flex-direction: column; + align-items: stretch; + } +} + .test1-shared-shell .container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; diff --git a/wp-content/themes/twentytwentyfour/functions.php b/wp-content/themes/twentytwentyfour/functions.php index 18922841..688e9e13 100644 --- a/wp-content/themes/twentytwentyfour/functions.php +++ b/wp-content/themes/twentytwentyfour/functions.php @@ -452,7 +452,7 @@ add_filter( 'template_include', 'twentytwentyfour_single_post_template', 25 ); * @return void */ function twentytwentyfour_test1_assets() { - $use_test1_assets = is_front_page() || is_home() || is_singular( 'post' ) || is_page( array( 'test1', 'faq', 'contacts', 'delivery', 'service' ) ); + $use_test1_assets = is_front_page() || is_home() || is_singular( 'post' ) || is_page( array( 'test1', 'faq', 'contacts', 'delivery', 'service' ) ) || twentytwentyfour_is_privacy_policy_request(); if ( ! $use_test1_assets ) { return; @@ -648,6 +648,10 @@ function twentytwentyfour_submit_lead_ajax() { $form_type = isset( $_POST['form_type'] ) ? sanitize_key( wp_unslash( $_POST['form_type'] ) ) : 'contacts_page'; $page_url = isset( $_POST['page_url'] ) ? esc_url_raw( wp_unslash( $_POST['page_url'] ) ) : ''; + if ( empty( $_POST['privacy_consent'] ) ) { + wp_send_json_error( array( 'message' => __( 'Необходимо согласиться на обработку персональных данных.', 'twentytwentyfour' ) ), 422 ); + } + if ( 'contacts' === $form_type ) { $form_type = false !== strpos( $page_url, '/contacts' ) ? 'contacts_page' : 'landing_contacts'; } @@ -728,6 +732,96 @@ function twentytwentyfour_submit_lead_ajax() { add_action( 'wp_ajax_twentytwentyfour_submit_lead', 'twentytwentyfour_submit_lead_ajax' ); add_action( 'wp_ajax_nopriv_twentytwentyfour_submit_lead', 'twentytwentyfour_submit_lead_ajax' ); +function twentytwentyfour_is_privacy_policy_request() { + if ( is_admin() || empty( $_SERVER['REQUEST_URI'] ) ) { + return false; + } + + $request_path = trim( wp_parse_url( wp_unslash( $_SERVER['REQUEST_URI'] ), PHP_URL_PATH ), '/' ); + + return 'privacy-policy' === $request_path; +} + +function twentytwentyfour_privacy_policy_url() { + return home_url( '/privacy-policy/' ); +} + +function twentytwentyfour_privacy_policy_template() { + if ( twentytwentyfour_is_privacy_policy_request() ) { + status_header( 200 ); + include get_theme_file_path( 'page-privacy-policy.php' ); + exit; + } +} +add_action( 'template_redirect', 'twentytwentyfour_privacy_policy_template', 0 ); + +function twentytwentyfour_privacy_consent_checkbox() { + ?> + + +
+ + " aria-label="" required> + @@ -78,3 +79,4 @@ get_header( 'test1', $test1_header_args ); 'test1-shared-shell test1-shared-privacy-page', + 'header_action_url' => function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : home_url( '/cart/' ), + 'header_action_label' => __( 'Корзина', 'twentytwentyfour' ), + 'header_mode' => 'link', +); + +get_header( 'test1', $test1_header_args ); +?> + +