| 1 |
<?php |
| 2 |
/** |
| 3 |
* The plugin settings fields. |
| 4 |
* |
| 5 |
* @author MyPreview (Github: @mahdiyazdani, @gooklani, @mypreview) |
| 6 |
* |
| 7 |
* @since 1.4.0 |
| 8 |
* |
| 9 |
* @package woo-additional-terms |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace Woo_Additional_Terms\Settings\Sections; |
| 13 |
|
| 14 |
use Woo_Additional_Terms\WooCommerce; |
| 15 |
|
| 16 |
/** |
| 17 |
* Class Settings fields. |
| 18 |
*/ |
| 19 |
class General extends Section { |
| 20 |
|
| 21 |
/** |
| 22 |
* Retrieve the settings fields for the general (default) settings tab. |
| 23 |
* |
| 24 |
* @since 1.4.0 |
| 25 |
* |
| 26 |
* @return array |
| 27 |
*/ |
| 28 |
public function get_fields() { |
| 29 |
|
| 30 |
return array( |
| 31 |
'section_title' => array( |
| 32 |
'id' => 'woo-additional-terms-general', |
| 33 |
'type' => 'title', |
| 34 |
'name' => _x( 'Woo Additional Terms', 'settings section name', 'woo-additional-terms' ), |
| 35 |
'desc' => _x( 'Add an extra “I agree” checkbox to your checkout page, giving users the opportunity to explicitly agree to specific terms before completing their purchase. Save time, reduce disputes, and create a better shopping experience.', 'settings field description', 'woo-additional-terms' ), |
| 36 |
), |
| 37 |
'status' => array( |
| 38 |
'name' => _x( 'Status', 'settings field name', 'woo-additional-terms' ), |
| 39 |
'desc' => _x( 'Choose “Active” to enable the terms checkbox during checkout, allowing customers to agree to the specified terms before purchase. Select “Disabled” to deactivate (draft) the terms checkbox, hiding it from the checkout process.', 'settings field description', 'woo-additional-terms' ), |
| 40 |
'type' => 'select', |
| 41 |
'class' => 'wc-enhanced-select', |
| 42 |
'id' => 'woo_additional_terms_options[status]', |
| 43 |
'options' => array( |
| 44 |
'1' => _x( 'Active', 'settings field option', 'woo-additional-terms' ), |
| 45 |
'0' => _x( 'Disabled', 'settings field option', 'woo-additional-terms' ), |
| 46 |
), |
| 47 |
'default' => '1', |
| 48 |
'desc_tip' => true, |
| 49 |
), |
| 50 |
'page' => array( |
| 51 |
'name' => _x( 'Terms Page', 'settings field name', 'woo-additional-terms' ), |
| 52 |
'desc' => _x( 'Search and select the desired terms page to link it with the checkbox.', 'settings field description', 'woo-additional-terms' ), |
| 53 |
'type' => 'single_select_page_with_search', |
| 54 |
'class' => 'wc-page-search', |
| 55 |
'css' => 'min-width:300px;', |
| 56 |
'id' => 'woo_additional_terms_options[page]', |
| 57 |
'args' => array( |
| 58 |
'exclude' => |
| 59 |
array( |
| 60 |
wc_get_page_id( 'cart' ), |
| 61 |
wc_get_page_id( 'checkout' ), |
| 62 |
wc_get_page_id( 'myaccount' ), |
| 63 |
), |
| 64 |
), |
| 65 |
'desc_tip' => true, |
| 66 |
'autoload' => false, |
| 67 |
), |
| 68 |
'action' => array( |
| 69 |
'name' => _x( 'Link Action', 'settings field name', 'woo-additional-terms' ), |
| 70 |
'desc' => _x( 'This field provides you with options to control how the terms link behaves when clicked. The “Embed” option displays the content above the checkbox. Choosing “Modal” opens the content in a modal window, while “New Tab” opens the linked page in a new browser tab.', 'settings field description', 'woo-additional-terms' ), |
| 71 |
'type' => 'select', |
| 72 |
'class' => 'wc-enhanced-select', |
| 73 |
'id' => 'woo_additional_terms_options[action]', |
| 74 |
'options' => array( |
| 75 |
'embed' => _x( 'Embed above checkbox', 'settings field option', 'woo-additional-terms' ), |
| 76 |
'modal' => _x( 'Open in modal', 'settings field option', 'woo-additional-terms' ), |
| 77 |
'newtab' => _x( 'Open in new tab', 'settings field option', 'woo-additional-terms' ), |
| 78 |
), |
| 79 |
'default' => 'embed', |
| 80 |
'desc_tip' => true, |
| 81 |
'autoload' => false, |
| 82 |
), |
| 83 |
'notice' => array( |
| 84 |
'name' => _x( 'Terms Text', 'settings field name', 'woo-additional-terms' ), |
| 85 |
'desc' => _x( 'Enter the desired text that will be displayed alongside the checkbox, ensuring clarity and transparency when customers agree to the specified terms during the checkout process.', 'settings field description', 'woo-additional-terms' ), |
| 86 |
'placeholder' => _x( 'I have read and agree to the website {{additional-terms}}', 'settings field placeholder', 'woo-additional-terms' ), |
| 87 |
'default' => _x( 'I have read and agree to the website {{additional-terms}}', 'settings field default', 'woo-additional-terms' ), |
| 88 |
'type' => 'textarea', |
| 89 |
'id' => 'woo_additional_terms_options[notice]', |
| 90 |
'desc_tip' => true, |
| 91 |
'autoload' => false, |
| 92 |
'custom_attributes' => array( |
| 93 |
'rows' => 4, |
| 94 |
'cols' => 50, |
| 95 |
), |
| 96 |
), |
| 97 |
'smart_tag_info' => array( |
| 98 |
'type' => 'info', |
| 99 |
'text' => sprintf( /* translators: 1: Open paragraph tag, 2: Terms smart tag, 3: Close paragraph tag. */ |
| 100 |
esc_html_x( '%1$sUse the %2$s smart tag in the Terms Text to automatically display the linked terms page title in your checkbox label.%3$s', 'settings field description', 'woo-additional-terms' ), |
| 101 |
'<p class="description">', |
| 102 |
'<code>{{additional-terms}}</code>', |
| 103 |
'</p>' |
| 104 |
), |
| 105 |
), |
| 106 |
'required' => array( |
| 107 |
'name' => _x( 'Required', 'settings field name', 'woo-additional-terms' ), |
| 108 |
'desc' => _x( 'Enable this to make the additional terms checkbox required.', 'settings field description', 'woo-additional-terms' ), |
| 109 |
'type' => 'checkbox', |
| 110 |
'id' => 'woo_additional_terms_options[required]', |
| 111 |
'default' => 'yes', |
| 112 |
), |
| 113 |
'error' => array( |
| 114 |
'name' => _x( 'Error Message', 'settings field name', 'woo-additional-terms' ), |
| 115 |
'desc' => _x( 'Add an error message to show if the customer does not accept the additional terms.', 'settings field description', 'woo-additional-terms' ), |
| 116 |
'placeholder' => _x( 'Please accept the additional terms to continue.', 'settings field placeholder', 'woo-additional-terms' ), |
| 117 |
'default' => _x( 'Please accept the additional terms to continue.', 'settings field default', 'woo-additional-terms' ), |
| 118 |
'type' => 'textarea', |
| 119 |
'id' => 'woo_additional_terms_options[error]', |
| 120 |
'desc_tip' => true, |
| 121 |
'autoload' => false, |
| 122 |
'custom_attributes' => array( |
| 123 |
'rows' => 4, |
| 124 |
'cols' => 50, |
| 125 |
), |
| 126 |
), |
| 127 |
'section_end' => array( |
| 128 |
'type' => 'sectionend', |
| 129 |
), |
| 130 |
); |
| 131 |
} |
| 132 |
} |
| 133 |
|