Skip to content

Commit b29cd6d

Browse files
authored
Merge pull request #140 from WebDevStudios/feature/CC-306-import-contact-field
Feature/cc 306 import contact field
2 parents a73ff88 + a0df590 commit b29cd6d

File tree

3 files changed

+21
-49
lines changed

3 files changed

+21
-49
lines changed

README.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Customers
6767
= 1.4.1 =
6868

6969
* Updated - Constant Contact Dashboard button now opens Dashboard in a new tab.
70+
* Updated - Set default value for importing contacts to 'true'.
71+
* Fix - Fixed broken form field layout on 'Import your contacts' tab.
7072

7173
= 1.4.0 =
7274

src/View/Admin/Field/ImportHistoricalData.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ public function get_form_field() : array {
3737
'desc' => $this->get_description(),
3838
'type' => 'select',
3939
'id' => self::OPTION_FIELD_NAME,
40-
'default' => '',
40+
'default' => 'true',
4141
'custom_attributes' => $this->get_custom_attributes(),
4242
'options' => [
43-
'' => '----',
4443
'false' => esc_html__( 'No', 'cc-woo' ),
4544
'true' => esc_html__( 'Yes', 'cc-woo' ),
4645
],

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
/**
@@ -508,38 +505,34 @@ private function get_store_information_settings() {
508505
* @return array
509506
*/
510507
private function get_customer_data_settings() {
508+
509+
$historical_import_field = new \WebDevStudios\CCForWoo\View\Admin\Field\ImportHistoricalData();
510+
511511
$settings = [
512512
[
513513
'title' => esc_html__( 'Import your contacts', 'cc-woo' ),
514514
'id' => 'cc_woo_customer_data_settings',
515515
'type' => 'title',
516+
'desc' => wp_kses(
517+
sprintf(
518+
__( "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' ),
519+
esc_url( 'https://www.constantcontact.com/legal/anti-spam' )
520+
),
521+
[
522+
'a' => [
523+
'href' => [],
524+
'target' => [],
525+
],
526+
]
527+
)
516528
],
529+
$historical_import_field->get_form_field(),
517530
[
518-
'title' => '',
519-
'id' => 'cc_woo_customer_data_message',
520-
'type' => 'title',
521-
'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' ),
531+
'type' => 'sectionend',
532+
'id' => 'cc_woo_customer_data_settings',
522533
],
523534
];
524535

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

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

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

0 commit comments

Comments
 (0)