Skip to content

Commit c141a98

Browse files
committed
CC-306 - Fix form field structure causing broken HTML and submit button above option
1 parent 7fa4a03 commit c141a98

File tree

1 file changed

+18
-47
lines changed

1 file changed

+18
-47
lines changed

src/View/Admin/WooTab.php

Lines changed: 18 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ public function register_hooks() {
178178
add_filter( 'woocommerce_settings_start', [ $this, 'validate_option_values' ], 10, 3 );
179179
add_action( "woocommerce_settings_save_{$this->id}", [ $this, 'save' ] );
180180
add_action( "woocommerce_settings_save_{$this->id}", [ $this, 'update_setup_option' ] );
181-
182-
// Custom field for labels.
183-
add_action( 'woocommerce_admin_field_cc_woo_anti_spam_notice', [ $this, 'display_anti_spam_notice' ] );
184181
}
185182

186183
/**
@@ -507,38 +504,34 @@ private function get_store_information_settings() {
507504
* @return array
508505
*/
509506
private function get_customer_data_settings() {
507+
508+
$historical_import_field = new \WebDevStudios\CCForWoo\View\Admin\Field\ImportHistoricalData();
509+
510510
$settings = [
511511
[
512512
'title' => esc_html__( 'Import your contacts', 'cc-woo' ),
513513
'id' => 'cc_woo_customer_data_settings',
514514
'type' => 'title',
515+
'desc' => wp_kses(
516+
sprintf(
517+
__( "Start marketing to your customers right away by importing all your contacts now.\n\nDo you want to import your current contacts? By selecting yes below, you agree you have permission to market to your current contacts. \n\nSee more on Constant Contact's <a href='%s' target='_blank'>anti-spam policy</a>.", 'cc-woo' ),
518+
esc_url( 'https://www.constantcontact.com/legal/anti-spam' )
519+
),
520+
[
521+
'a' => [
522+
'href' => [],
523+
'target' => [],
524+
],
525+
]
526+
)
515527
],
528+
$historical_import_field->get_form_field(),
516529
[
517-
'title' => '',
518-
'id' => 'cc_woo_customer_data_message',
519-
'type' => 'title',
520-
'desc' => esc_html__( "Start marketing to your customers right away by importing all your contacts now.\n\nDo you want to import your current contacts? By selecting yes below, you agree you have permission to market to your current contacts.", 'cc-woo' ),
530+
'type' => 'sectionend',
531+
'id' => 'cc_woo_customer_data_settings',
521532
],
522533
];
523534

524-
$historical_import_field = new \WebDevStudios\CCForWoo\View\Admin\Field\ImportHistoricalData();
525-
526-
$settings[] = array_merge(
527-
$settings,
528-
$historical_import_field->get_form_field(),
529-
[
530-
[
531-
'title' => '',
532-
'type' => 'cc_woo_anti_spam_notice',
533-
'id' => 'anti-spam-notice',
534-
],
535-
[
536-
'type' => 'sectionend',
537-
'id' => 'cc_woo_customer_data_settings',
538-
],
539-
]
540-
);
541-
542535
return $settings;
543536
}
544537

@@ -831,28 +824,6 @@ public function get_woo_country() : string {
831824
return wc_get_base_location()['country'] ?? '';
832825
}
833826

834-
/**
835-
* Display a link to the anti-spam policy.
836-
*
837-
* @since 2019-05-17
838-
* @author Zach Owen <zach@webdevstudios>
839-
*/
840-
public function display_anti_spam_notice() {
841-
?>
842-
<tr>
843-
<td colspan="2">
844-
<?php
845-
echo sprintf(
846-
// phpcs:ignore -- output is escaped properly with esc_url.
847-
__( 'See more on Constant Contact\'s <a href="%s" target="_blank">anti-spam policy</a>.', 'cc-woo' ),
848-
esc_url( 'https://www.constantcontact.com/legal/anti-spam' )
849-
);
850-
?>
851-
</td>
852-
</tr>
853-
<?php
854-
}
855-
856827
/**
857828
* Save settings.
858829
*

0 commit comments

Comments
 (0)