| 1 |
<?php |
| 2 |
/** |
| 3 |
* Checkout |
| 4 |
* |
| 5 |
* @package |
| 6 |
*/ |
| 7 |
namespace WPFunnels\Widgets\Oxygen; |
| 8 |
|
| 9 |
use WPFunnels\Wpfnl_functions; |
| 10 |
|
| 11 |
/** |
| 12 |
* Class Checkout |
| 13 |
* |
| 14 |
* @package WPFunnels\Widgets\Oxygen |
| 15 |
*/ |
| 16 |
class Checkout extends Elements { |
| 17 |
|
| 18 |
function init() { |
| 19 |
// Do some initial things here. |
| 20 |
} |
| 21 |
|
| 22 |
function afterInit() { |
| 23 |
// Do things after init, like remove apply params button and remove the add button. |
| 24 |
$this->removeApplyParamsButton(); |
| 25 |
// $this->removeAddButton(); |
| 26 |
} |
| 27 |
|
| 28 |
function name() { |
| 29 |
return 'WPF Checkout'; |
| 30 |
} |
| 31 |
|
| 32 |
function slug() { |
| 33 |
return "wpf-checkout"; |
| 34 |
} |
| 35 |
|
| 36 |
function icon() { |
| 37 |
return plugin_dir_url(__FILE__) . 'icon/checkout.svg'; |
| 38 |
} |
| 39 |
|
| 40 |
// function button_place() { |
| 41 |
// // return "interactive"; |
| 42 |
// } |
| 43 |
|
| 44 |
function button_priority() { |
| 45 |
// return 9; |
| 46 |
} |
| 47 |
|
| 48 |
|
| 49 |
function render( $options, $defaults, $content ) { |
| 50 |
if( !Wpfnl_functions::check_if_this_is_step_type( 'checkout' ) ) { |
| 51 |
echo __( 'Sorry, Please place the element in WPFunnels Checkout page','wpfnl' ); |
| 52 |
} |
| 53 |
else { |
| 54 |
$step_id = isset( $_GET[ 'post_id' ] ) ? $_GET[ 'post_id' ] : get_the_ID(); |
| 55 |
$checkout_layout = isset( $options[ 'layout' ] ) ? $options[ 'layout' ] : ''; |
| 56 |
|
| 57 |
update_post_meta( $step_id, '_wpfnl_checkout_layout', $checkout_layout ); |
| 58 |
|
| 59 |
add_filter( 'woocommerce_locate_template', array( $this, 'wpfunnels_woocommerce_locate_template' ), 20, 3 ); |
| 60 |
do_action( 'wpfunnels/before_checkout_form', $step_id ); |
| 61 |
|
| 62 |
if( PHP_SESSION_DISABLED == session_status() ) { |
| 63 |
session_start(); |
| 64 |
} |
| 65 |
$_SESSION[ 'checkout_layout' ] = $checkout_layout; |
| 66 |
|
| 67 |
if( \WPFunnels\Wpfnl_functions::is_wpfnl_pro_activated() && 'wpfnl-express-checkout' === $checkout_layout ) { |
| 68 |
$checkout_layout .= ' wpfnl-multistep'; |
| 69 |
} |
| 70 |
|
| 71 |
if( \WPFunnels\Wpfnl_functions::is_wpfnl_pro_activated() && 'wpfnl-2-step' === $checkout_layout ) { |
| 72 |
$checkout_layout .= ' wpfnl-multistep'; |
| 73 |
} |
| 74 |
|
| 75 |
//-----floating label class----- |
| 76 |
$floating_label = isset($options['checkout_floating_label']) ? $options['checkout_floating_label'] : ''; |
| 77 |
|
| 78 |
$html = '<div class="wpfnl-checkout ' . $checkout_layout .' '. $floating_label .'" >'; |
| 79 |
$html .= do_shortcode( '[woocommerce_checkout]' ); |
| 80 |
$html .= '</div>'; |
| 81 |
|
| 82 |
echo $html; |
| 83 |
} |
| 84 |
} |
| 85 |
public static function wpfunnels_woocommerce_locate_template($template, $template_name, $template_path) |
| 86 |
{ |
| 87 |
global $woocommerce; |
| 88 |
$_template = $template; |
| 89 |
$plugin_path = WPFNL_DIR . '/woocommerce/templates/'; |
| 90 |
|
| 91 |
if (file_exists($plugin_path . $template_name)) { |
| 92 |
$template = $plugin_path . $template_name; |
| 93 |
} |
| 94 |
|
| 95 |
if ( ! $template ) { |
| 96 |
$template = $_template; |
| 97 |
} |
| 98 |
|
| 99 |
return $template; |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* Register widget controls. |
| 104 |
* |
| 105 |
* @since 2.8.2 |
| 106 |
*/ |
| 107 |
public function controls() { |
| 108 |
$this->configure_layout_section(); |
| 109 |
$this->configure_billing_section(); |
| 110 |
$this->configure_shipping_section(); |
| 111 |
$this->configure_order_section_style(); |
| 112 |
$this->configure_table_style(); |
| 113 |
$this->configure_payment_section_style(); |
| 114 |
$this->configure_order_button_style(); |
| 115 |
$this->configure_coupon_section_style(); |
| 116 |
$this->configure_multistep_style(); |
| 117 |
} |
| 118 |
|
| 119 |
/** |
| 120 |
* Configure the layout section settings for the checkout page. |
| 121 |
* |
| 122 |
* @since 2.8.2 |
| 123 |
*/ |
| 124 |
private function configure_layout_section() { |
| 125 |
// Add a control section for layout settings |
| 126 |
$layout = $this->addControlSection( |
| 127 |
'optin_layout', |
| 128 |
__('Layout', 'wpfnl'), |
| 129 |
'assets/icon.png', |
| 130 |
$this |
| 131 |
); |
| 132 |
|
| 133 |
// Add a dropdown option control for selecting layout |
| 134 |
$layout->addOptionControl( |
| 135 |
array( |
| 136 |
'type' => 'dropdown', |
| 137 |
'name' => __('Layout', 'wpfnl'), |
| 138 |
'slug' => 'layout', |
| 139 |
'default' => 'wpfnl-col-2' |
| 140 |
) |
| 141 |
)->setValue( |
| 142 |
array( |
| 143 |
'wpfnl-col-1' => __('1 Column Checkout', 'wpfnl'), |
| 144 |
'wpfnl-col-2' => __('2 Column Checkout', 'wpfnl'), |
| 145 |
'wpfnl-2-step' => __('2 Step Checkout', 'wpfnl'), |
| 146 |
'wpfnl-multistep' => __('Multistep Checkout', 'wpfnl'), |
| 147 |
'wpfnl-express-checkout' => __('Express Checkout', 'wpfnl'), |
| 148 |
) |
| 149 |
)->rebuildElementOnChange(); |
| 150 |
|
| 151 |
// Add a dropdown option control for floating label selection |
| 152 |
$layout->addOptionControl( |
| 153 |
array( |
| 154 |
'type' => 'dropdown', |
| 155 |
'name' => __('Floating Label', 'wpfnl'), |
| 156 |
'slug' => 'checkout_floating_label', |
| 157 |
'default' => '' |
| 158 |
) |
| 159 |
)->setValue( |
| 160 |
array( |
| 161 |
'' => __('Select option', 'wpfnl'), |
| 162 |
'floating-label' => __('Floating Label', 'wpfnl'), |
| 163 |
) |
| 164 |
)->rebuildElementOnChange(); |
| 165 |
} |
| 166 |
|
| 167 |
/** |
| 168 |
* Configure the billing section styles for the checkout page. |
| 169 |
* |
| 170 |
* @since 2.8.2 |
| 171 |
*/ |
| 172 |
private function configure_billing_section() { |
| 173 |
// Configure Billing Header Style |
| 174 |
$this->configure_header_style( |
| 175 |
'billing_header', |
| 176 |
__('Billing Heading', 'wpfnl'), |
| 177 |
'.wpfnl-checkout .woocommerce-billing-fields > h3' |
| 178 |
); |
| 179 |
|
| 180 |
// Configure Billing Label Style |
| 181 |
$this->configure_label_and_input_style( |
| 182 |
'billing_label', |
| 183 |
__('Billing Input Label', 'wpfnl'), |
| 184 |
'.wpfnl-checkout .woocommerce-billing-fields p.form-row label', |
| 185 |
'Label Margin' |
| 186 |
); |
| 187 |
|
| 188 |
// Configure Billing Input Style |
| 189 |
$this->configure_label_and_input_style( |
| 190 |
'billing_inputs', |
| 191 |
__('Billing Input Field', 'wpfnl'), |
| 192 |
'.wpfnl-checkout .woocommerce-billing-fields .form-row input.input-text, .wpfnl-checkout .woocommerce-billing-fields .form-row textarea, .wpfnl-checkout .woocommerce-billing-fields .select2-container--default .select2-selection--single, .wpfnl-checkout .woocommerce-billing-fields .form-row select, .wpfnl-checkout .woocommerce-billing-fields ::placeholder, .wpfnl-checkout .woocommerce-billing-fields ::-webkit-input-placeholder, .wpfnl-checkout.floating-label #customer_details #wpfnl_checkout_billing .form-row:not(.create-account) input.input-text:not(#billing_address_2, #shipping_address_2), .wpfnl-checkout.floating-label #customer_details #wpfnl_checkout_billing .form-row:not(.create-account) textarea', |
| 193 |
'Input Margin' |
| 194 |
); |
| 195 |
} |
| 196 |
|
| 197 |
/** |
| 198 |
* Configure the header style for a specific section on the checkout page. |
| 199 |
* |
| 200 |
* @param string $sectionId The ID of the section. |
| 201 |
* @param string $sectionTitle The title of the section. |
| 202 |
* @param string $selector The CSS selector for the section. |
| 203 |
* |
| 204 |
* @since 2.8.2 |
| 205 |
*/ |
| 206 |
private function configure_header_style($sectionId, $sectionTitle, $selector) { |
| 207 |
$section = $this->addControlSection($sectionId, $sectionTitle, 'assets/icon.png', $this); |
| 208 |
$section->typographySection(__('Heading Typography', 'wpfnl'), $selector, $this); |
| 209 |
$this->configure_common_style($section, $selector, 'Heading Border'); |
| 210 |
} |
| 211 |
|
| 212 |
/** |
| 213 |
* Configure the label and input style for a specific section on the checkout page. |
| 214 |
* |
| 215 |
* @param string $sectionId The ID of the section. |
| 216 |
* @param string $sectionTitle The title of the section. |
| 217 |
* @param string $selector The CSS selector for the section. |
| 218 |
* @param string $marginControlName The name of the margin control. |
| 219 |
* |
| 220 |
* @since 2.8.2 |
| 221 |
*/ |
| 222 |
private function configure_label_and_input_style($sectionId, $sectionTitle, $selector, $marginControlName) { |
| 223 |
$section = $this->addControlSection($sectionId, $sectionTitle, 'assets/icon.png', $this); |
| 224 |
$section->addPreset('margin', "{$sectionId}_margin", __($marginControlName, 'wpfnl'), $selector)->whiteList(); |
| 225 |
$section->typographySection(__('Label Typography', 'wpfnl'), $selector, $this); |
| 226 |
$this->configure_common_style($section, $selector, 'Input Border'); |
| 227 |
} |
| 228 |
|
| 229 |
/** |
| 230 |
* Configure common style settings for a specific section on the checkout page. |
| 231 |
* |
| 232 |
* @param object $section The section to configure. |
| 233 |
* @param string $selector The CSS selector for the section. |
| 234 |
* @param string $borderSectionTitle The title for the border section. |
| 235 |
* |
| 236 |
* @since 2.8.2 |
| 237 |
*/ |
| 238 |
private function configure_common_style($section, $selector, $borderSectionTitle) { |
| 239 |
$section->addPreset('padding', "{$section->id}_padding", __('Padding', 'wpfnl'), $selector)->whiteList(); |
| 240 |
$section->addStyleControls([ |
| 241 |
[ |
| 242 |
'name' => __('Background Color', 'wpfnl'), |
| 243 |
'selector' => $selector, |
| 244 |
'property' => 'background-color', |
| 245 |
], |
| 246 |
]); |
| 247 |
$section->borderSection($borderSectionTitle, $selector, $this); |
| 248 |
} |
| 249 |
|
| 250 |
/** |
| 251 |
* Configure the styling for the shipping section on the checkout page. |
| 252 |
* |
| 253 |
* @since 2.8.2 |
| 254 |
*/ |
| 255 |
private function configure_shipping_section() { |
| 256 |
// Configure Shipping Header Style |
| 257 |
$this->configure_header_style( |
| 258 |
'shipping_header', |
| 259 |
__('Shipping Heading', 'wpfnl'), |
| 260 |
'.wpfnl-checkout .woocommerce-shipping-fields #ship-to-different-address span, .wpfnl-checkout .woocommerce-additional-fields > h3' |
| 261 |
); |
| 262 |
|
| 263 |
// Configure Shipping Label Style |
| 264 |
$this->configure_label_and_input_style( |
| 265 |
'shipping_label', |
| 266 |
__('Shipping Input Label', 'wpfnl'), |
| 267 |
'.wpfnl-checkout .woocommerce-shipping-fields p.form-row label, .wpfnl-checkout .woocommerce-additional-fields p.form-row label', |
| 268 |
'Label Margin' |
| 269 |
); |
| 270 |
|
| 271 |
// Configure Shipping Input Style |
| 272 |
$this->configure_label_and_input_style( |
| 273 |
'shipping_inputs', |
| 274 |
__('Shipping Input Field', 'wpfnl'), |
| 275 |
'.wpfnl-checkout .woocommerce-shipping-fields .form-row input.input-text, .wpfnl-checkout .woocommerce-additional-fields .form-row textarea, .wpfnl-checkout .woocommerce-shipping-fields .select2-container--default .select2-selection--single, .wpfnl-checkout .woocommerce-shipping-fields .form-row select, .wpfnl-checkout .woocommerce-shipping-fields ::placeholder, .wpfnl-checkout .woocommerce-shipping-fields ::-webkit-input-placeholder, .wpfnl-checkout .woocommerce-additional-fields ::placeholder, .wpfnl-checkout .woocommerce-additional-fields ::-webkit-input-placeholder, .wpfnl-checkout.floating-label #customer_details #wpfnl_checkout_shipping .form-row:not(.create-account) input.input-text:not(#billing_address_2, #shipping_address_2), .wpfnl-checkout.floating-label #customer_details #wpfnl_checkout_shipping .form-row:not(.create-account) textarea', |
| 276 |
'Input Margin' |
| 277 |
); |
| 278 |
} |
| 279 |
|
| 280 |
/** |
| 281 |
* Configure the styling for the order section heading on the checkout page. |
| 282 |
* |
| 283 |
* @since 2.8.2 |
| 284 |
*/ |
| 285 |
private function configure_order_section_style() { |
| 286 |
// Add Control Section for Order Header |
| 287 |
$order_header = $this->addControlSection('order_header', __('Order Heading','wpfnl'), 'assets/icon.png', $this); |
| 288 |
|
| 289 |
// Selector for Order Header |
| 290 |
$order_header_selector = '.wpfnl-checkout .woocommerce-checkout #order_review_heading'; |
| 291 |
|
| 292 |
// Configure Typography for Order Header |
| 293 |
$order_header->typographySection( |
| 294 |
__('Heading Typography','wpfnl'), |
| 295 |
$order_header_selector, |
| 296 |
$this |
| 297 |
); |
| 298 |
|
| 299 |
// Configure Padding Preset for Order Header |
| 300 |
$order_header->addPreset( |
| 301 |
'padding', |
| 302 |
'order_header_padding', |
| 303 |
__('Padding','wpfnl'), |
| 304 |
$order_header_selector |
| 305 |
)->whiteList(); |
| 306 |
|
| 307 |
// Configure Margin Preset for Order Header |
| 308 |
$order_header->addPreset( |
| 309 |
'margin', |
| 310 |
'order_header_margin', |
| 311 |
__('Margin','wpfnl'), |
| 312 |
$order_header_selector |
| 313 |
)->whiteList(); |
| 314 |
|
| 315 |
// Configure Background Color Style for Order Header |
| 316 |
$order_header->addStyleControls([ |
| 317 |
[ |
| 318 |
'name' => __('Background Color','wpfnl'), |
| 319 |
'selector' => $order_header_selector, |
| 320 |
'property' => 'background-color', |
| 321 |
], |
| 322 |
]); |
| 323 |
|
| 324 |
// Configure Border Section for Order Header |
| 325 |
$order_header->borderSection( |
| 326 |
__('Heading Border','wpfnl'), |
| 327 |
$order_header_selector, |
| 328 |
$this |
| 329 |
); |
| 330 |
} |
| 331 |
|
| 332 |
/** |
| 333 |
* Configure the styling for the order table on the checkout page. |
| 334 |
* |
| 335 |
* @since 2.8.2 |
| 336 |
*/ |
| 337 |
private function configure_table_style() { |
| 338 |
// Add Control Section for Order Table. |
| 339 |
$order_table_section = $this->addControlSection('order_table_section', __('Order Table','wpfnl'), 'assets/icon.png', $this); |
| 340 |
|
| 341 |
// Selector for Order Table cells |
| 342 |
$order_table = '.wpfnl-checkout .woocommerce-checkout table.woocommerce-checkout-review-order-table td, .wpfnl-checkout .woocommerce-checkout table.woocommerce-checkout-review-order-table th'; |
| 343 |
|
| 344 |
// Configure Margin Preset for Order Table. |
| 345 |
$order_table_section->addPreset( |
| 346 |
'margin', |
| 347 |
'order_table_margin', |
| 348 |
__('Table Margin','wpfnl'), |
| 349 |
'.wpfnl-checkout .woocommerce table.shop_table' |
| 350 |
)->whiteList(); |
| 351 |
|
| 352 |
// Configure Padding Preset for Order Table Cells. |
| 353 |
$order_table_section->addPreset( |
| 354 |
'padding', |
| 355 |
'order_tbl_cell_padding', |
| 356 |
__('Cell Padding','wpfnl'), |
| 357 |
'.wpfnl-checkout .woocommerce table.shop_table thead th, .wpfnl-checkout .woocommerce table.shop_table thead td, .wpfnl-checkout .woocommerce table.shop_table tbody th, .wpfnl-checkout .woocommerce table.shop_table tbody td, .wpfnl-checkout .woocommerce table.shop_table tfoot td, .wpfnl-checkout .woocommerce table.shop_table tfoot th' |
| 358 |
)->whiteList(); |
| 359 |
|
| 360 |
// Configure Background Color Style for Order Table. |
| 361 |
$order_table_section->addStyleControls([ |
| 362 |
[ |
| 363 |
'name' => __('Background Color','wpfnl'), |
| 364 |
'selector' => '.wpfnl-checkout .woocommerce table.shop_table', |
| 365 |
'property' => 'background-color', |
| 366 |
], |
| 367 |
]); |
| 368 |
|
| 369 |
// Configure Typography for Order Table Cells. |
| 370 |
$order_table_section->typographySection( |
| 371 |
__('Table Typography','wpfnl'), |
| 372 |
$order_table, |
| 373 |
$this |
| 374 |
); |
| 375 |
|
| 376 |
// Configure Border Section for Order Table. |
| 377 |
$order_table_section->borderSection( |
| 378 |
__('Table Border','wpfnl'), |
| 379 |
'.wpfnl-checkout .woocommerce table.shop_table', |
| 380 |
$this |
| 381 |
); |
| 382 |
} |
| 383 |
|
| 384 |
/** |
| 385 |
* Configure the styling for the payment section on the checkout page. |
| 386 |
* |
| 387 |
* @since 2.8.2 |
| 388 |
*/ |
| 389 |
private function configure_payment_section_style() { |
| 390 |
// Add Control Section for Payment Section. |
| 391 |
$payment_section = $this->addControlSection('payment_section', __('Payment Section', 'wpfnl'), 'assets/icon.png', $this); |
| 392 |
|
| 393 |
// Configure Background Color Style for Payment Section. |
| 394 |
$payment_section->addStyleControls([ |
| 395 |
[ |
| 396 |
'name' => __('Payment Section Background Color', 'wpfnl'), |
| 397 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment', |
| 398 |
'property' => 'background-color', |
| 399 |
], |
| 400 |
]); |
| 401 |
|
| 402 |
// Configure Link Color Style for Payment Section. |
| 403 |
$payment_section->addStyleControls([ |
| 404 |
[ |
| 405 |
'name' => __('Payment Section Link Color', 'wpfnl'), |
| 406 |
'selector' => '.wpfnl-checkout #payment .place-order a, .wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods > li > label a, .wpfnl-checkout .woocommerce-checkout #payment ul.payment_methods > li > label a', |
| 407 |
'property' => 'color', |
| 408 |
], |
| 409 |
]); |
| 410 |
|
| 411 |
// Configure Typography for Payment Section. |
| 412 |
$payment_section->typographySection( |
| 413 |
__('Payment Section Typography', 'wpfnl'), |
| 414 |
'.wpfnl-checkout #payment .place-order p, .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox .woocommerce-terms-and-conditions-checkbox-text', |
| 415 |
$this |
| 416 |
); |
| 417 |
|
| 418 |
// Configure Border Section for Payment Section. |
| 419 |
$payment_section->borderSection( |
| 420 |
__('Payment Section Border', 'wpfnl'), |
| 421 |
'.wpfnl-checkout .woocommerce-checkout #payment', |
| 422 |
$this |
| 423 |
); |
| 424 |
|
| 425 |
// Add Style Controls for Payment Method Typography. |
| 426 |
$payment_section->typographySection( |
| 427 |
__('Payment Method Typography', 'wpfnl'), |
| 428 |
'.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods > li > label, .wpfnl-checkout .woocommerce-checkout #payment ul.payment_methods > li > label', |
| 429 |
$this |
| 430 |
); |
| 431 |
|
| 432 |
// Configure Border Section for Payment Method. |
| 433 |
$payment_section->borderSection( |
| 434 |
__('Payment Method Border', 'wpfnl'), |
| 435 |
'.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods > li, .wpfnl-checkout .woocommerce-checkout #payment ul.payment_methods > li', |
| 436 |
$this |
| 437 |
); |
| 438 |
|
| 439 |
// Add Preset for Payment Method Padding. |
| 440 |
$payment_section->addPreset( |
| 441 |
'padding', |
| 442 |
'payment_method_padding', |
| 443 |
__('Payment Method Padding', 'wpfnl'), |
| 444 |
'.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods > li, .wpfnl-checkout .woocommerce-checkout #payment ul.payment_methods > li' |
| 445 |
)->whiteList(); |
| 446 |
|
| 447 |
// Add Style Controls for Payment Method Tooltip. |
| 448 |
$payment_section->addStyleControls([ |
| 449 |
[ |
| 450 |
'name' => __('Payment Method Tooltip Background Color', 'wpfnl'), |
| 451 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment div.payment_box', |
| 452 |
'property' => 'background-color', |
| 453 |
], |
| 454 |
[ |
| 455 |
'name' => __('Payment Method Tooltip Border Color', 'wpfnl'), |
| 456 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment div.payment_box:before', |
| 457 |
'property' => 'border-bottom-color', |
| 458 |
], |
| 459 |
]); |
| 460 |
|
| 461 |
// Add Preset for Payment Method Tooltip Padding. |
| 462 |
$payment_section->addPreset( |
| 463 |
'padding', |
| 464 |
'payment_method_tooltip_padding', |
| 465 |
__('Payment Method Tooltip Padding', 'wpfnl'), |
| 466 |
'.wpfnl-checkout .woocommerce-checkout #payment div.payment_box' |
| 467 |
)->whiteList(); |
| 468 |
|
| 469 |
// Add Style Controls for Payment Method Radio Button and Checkbox. |
| 470 |
$payment_section->addStyleControls([ |
| 471 |
[ |
| 472 |
'name' => __('Radio Button Default Color', 'wpfnl'), |
| 473 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods > li > label:before, .wpfnl-checkout .woocommerce-checkout #payment ul.payment_methods > li > label:before', |
| 474 |
'property' => 'border-color', |
| 475 |
], |
| 476 |
[ |
| 477 |
'name' => __('Radio Button Active Color', 'wpfnl'), |
| 478 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods > li > input[type=radio]:checked + label:before, .wpfnl-checkout .woocommerce-checkout #payment ul.payment_methods > li > input[type=radio]:checked + label:before', |
| 479 |
'property' => 'border-color', |
| 480 |
], |
| 481 |
[ |
| 482 |
'name' => __('Radio Button Active Background Color', 'wpfnl'), |
| 483 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods > li > input[type=radio]:checked + label:after, .wpfnl-checkout .woocommerce-checkout #payment ul.payment_methods > li > input[type=radio]:checked + label:after', |
| 484 |
'property' => 'background-color', |
| 485 |
], |
| 486 |
[ |
| 487 |
'name' => __('Checkbox Default Color', 'wpfnl'), |
| 488 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods-saveNew > label:before, .wpfnl-checkout #mailpoet_woocommerce_checkout_optin_field #mailpoet_woocommerce_checkout_optin', |
| 489 |
'property' => 'border-color', |
| 490 |
], |
| 491 |
[ |
| 492 |
'name' => __('Checkbox Active Color', 'wpfnl'), |
| 493 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods-saveNew > input[type=checkbox]:checked + label:before, .wpfnl-checkout #mailpoet_woocommerce_checkout_optin_field #mailpoet_woocommerce_checkout_optin:checked', |
| 494 |
'property' => 'border-color', |
| 495 |
], |
| 496 |
[ |
| 497 |
'name' => __('Checkbox Active Background Color', 'wpfnl'), |
| 498 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods-saveNew > input[type=checkbox]:checked + label:before, .wpfnl-checkout #mailpoet_woocommerce_checkout_optin_field #mailpoet_woocommerce_checkout_optin:checked', |
| 499 |
'property' => 'background-color', |
| 500 |
], |
| 501 |
[ |
| 502 |
'name' => __('Checkbox Tic Sign Color', 'wpfnl'), |
| 503 |
'selector' => '.wpfnl-checkout .woocommerce-checkout #payment .woocommerce-SavedPaymentMethods-saveNew > label:after', |
| 504 |
'property' => 'border-color', |
| 505 |
], |
| 506 |
]); |
| 507 |
|
| 508 |
// Configure Typography for Payment Method Tooltip. |
| 509 |
$payment_section->typographySection( |
| 510 |
__('Payment Method Tooltip Typography', 'wpfnl'), |
| 511 |
'.wpfnl-checkout .woocommerce-checkout #payment div.payment_box, .wpfnl-checkout .woocommerce-checkout #payment div.payment_box p', |
| 512 |
$this |
| 513 |
); |
| 514 |
} |
| 515 |
|
| 516 |
/** |
| 517 |
* Configure the styling for the order button on the checkout page. |
| 518 |
* |
| 519 |
* @since 2.8.2 |
| 520 |
*/ |
| 521 |
private function configure_order_button_style() { |
| 522 |
// Add Control Section for Order Button Section. |
| 523 |
$order_btn_section = $this->addControlSection('order_btn_section', __('Order Button Section', 'wpfnl'), 'assets/icon.png', $this); |
| 524 |
$order_btn = '.wpfnl-checkout .woocommerce #payment #place_order'; |
| 525 |
|
| 526 |
// Configure Padding for Order Button. |
| 527 |
$order_btn_section->addPreset('padding', 'order_btn_padding', __('Padding', 'wpfnl'), $order_btn)->whiteList(); |
| 528 |
|
| 529 |
// Configure Margin for Order Button. |
| 530 |
$order_btn_section->addPreset('margin', 'order_btn_margin', __('Margin', 'wpfnl'), $order_btn)->whiteList(); |
| 531 |
|
| 532 |
// Configure Typography for Order Button. |
| 533 |
$order_btn_section->typographySection(__('Typography', 'wpfnl'), $order_btn, $this); |
| 534 |
|
| 535 |
// Configure Background Color for Order Button. |
| 536 |
$order_btn_section->addStyleControls([ |
| 537 |
[ |
| 538 |
'name' => __('Background Color', 'wpfnl'), |
| 539 |
'selector' => $order_btn, |
| 540 |
'property' => 'background-color', |
| 541 |
], |
| 542 |
]); |
| 543 |
|
| 544 |
// Configure Background Hover Color for Order Button. |
| 545 |
$order_btn_section->addStyleControls([ |
| 546 |
[ |
| 547 |
'name' => __('Background Hover Color', 'wpfnl'), |
| 548 |
'selector' => $order_btn . ':hover', |
| 549 |
'property' => 'background-color', |
| 550 |
], |
| 551 |
]); |
| 552 |
|
| 553 |
// Configure Text Hover Color for Order Button. |
| 554 |
$order_btn_section->addStyleControls([ |
| 555 |
[ |
| 556 |
'name' => __('Text Hover Color', 'wpfnl'), |
| 557 |
'selector' => $order_btn . ':hover', |
| 558 |
'property' => 'color', |
| 559 |
], |
| 560 |
]); |
| 561 |
|
| 562 |
// Configure Border Section for Order Button. |
| 563 |
$order_btn_section->borderSection(__('Border', 'wpfnl'), $order_btn, $this); |
| 564 |
} |
| 565 |
|
| 566 |
/** |
| 567 |
* Configure the styling for the coupon section on the checkout page. |
| 568 |
* |
| 569 |
* @since 2.8.2 |
| 570 |
*/ |
| 571 |
private function configure_coupon_section_style() { |
| 572 |
// Add Control Section for Coupon Section. |
| 573 |
$coupon_section = $this->addControlSection('coupon_section', __('Coupon Section', 'wpfnl'), 'assets/icon.png', $this); |
| 574 |
$coupon_toggle_box = '.wpfnl-checkout .woocommerce-form-coupon-toggle .woocommerce-info'; |
| 575 |
|
| 576 |
// Configure Padding for Coupon Toggle Box. |
| 577 |
$coupon_section->addPreset('padding', 'coupon_toggle_box_padding', __('Coupon Toggle Box Padding', 'wpfnl'), $coupon_toggle_box)->whiteList(); |
| 578 |
|
| 579 |
// Configure Margin for Coupon Toggle Box. |
| 580 |
$coupon_section->addPreset('margin', 'coupon_toggle_box_margin', __('Coupon Toggle Box Margin', 'wpfnl'), $coupon_toggle_box)->whiteList(); |
| 581 |
|
| 582 |
// Configure Background Color for Coupon Toggle Box. |
| 583 |
$coupon_section->addStyleControls([ |
| 584 |
[ |
| 585 |
'name' => __('Coupon Toggle Box Background Color', 'wpfnl'), |
| 586 |
'selector' => $coupon_toggle_box, |
| 587 |
'property' => 'background-color', |
| 588 |
], |
| 589 |
]); |
| 590 |
|
| 591 |
// Configure Link Color for Coupon Toggle Box. |
| 592 |
$coupon_section->addStyleControls([ |
| 593 |
[ |
| 594 |
'name' => __('Coupon Toggle Box Link Color', 'wpfnl'), |
| 595 |
'selector' => $coupon_toggle_box . ' a', |
| 596 |
'property' => 'color', |
| 597 |
], |
| 598 |
]); |
| 599 |
|
| 600 |
// Configure Typography for Coupon Toggle Box. |
| 601 |
$coupon_section->typographySection(__('Coupon Toggle Box Typography', 'wpfnl'), $coupon_toggle_box, $this); |
| 602 |
|
| 603 |
// Configure Border Section for Coupon Toggle Box. |
| 604 |
$coupon_section->borderSection(__('Coupon Toggle Box Border', 'wpfnl'), $coupon_toggle_box, $this); |
| 605 |
|
| 606 |
// Configure Coupon Form Style. |
| 607 |
$coupon_form = '.wpfnl-checkout .checkout_coupon.woocommerce-form-coupon'; |
| 608 |
|
| 609 |
// Configure Padding for Coupon Form. |
| 610 |
$coupon_section->addPreset('padding', 'coupon_form_padding', __('Coupon Form Padding', 'wpfnl'), $coupon_form)->whiteList(); |
| 611 |
|
| 612 |
// Configure Margin for Coupon Form. |
| 613 |
$coupon_section->addPreset('margin', 'coupon_form_margin', __('Coupon Form Margin', 'wpfnl'), $coupon_form)->whiteList(); |
| 614 |
|
| 615 |
// Configure Background Color for Coupon Form. |
| 616 |
$coupon_section->addStyleControls([ |
| 617 |
[ |
| 618 |
'name' => __('Coupon Form Background Color', 'wpfnl'), |
| 619 |
'selector' => $coupon_form, |
| 620 |
'property' => 'background-color', |
| 621 |
], |
| 622 |
]); |
| 623 |
|
| 624 |
// Configure Typography for Coupon Form. |
| 625 |
$coupon_section->typographySection(__('Coupon Form Typography', 'wpfnl'), $coupon_form . ' p:not(.form-row)', $this); |
| 626 |
|
| 627 |
// Configure Border Section for Coupon Form. |
| 628 |
$coupon_section->borderSection(__('Coupon Form Border', 'wpfnl'), $coupon_form, $this); |
| 629 |
|
| 630 |
// Configure Coupon Input Field Style. |
| 631 |
$coupon_input_field = '.wpfnl-checkout .checkout_coupon.woocommerce-form-coupon input.input-text'; |
| 632 |
|
| 633 |
// Configure Typography for Coupon Input Field. |
| 634 |
$coupon_section->typographySection(__('Coupon Form Input Field Typography', 'wpfnl'), $coupon_input_field, $this); |
| 635 |
|
| 636 |
// Configure Background Color for Coupon Input Field. |
| 637 |
$coupon_section->addStyleControls([ |
| 638 |
[ |
| 639 |
'name' => __('Coupon Form Input Field Background Color', 'wpfnl'), |
| 640 |
'selector' => $coupon_input_field, |
| 641 |
'property' => 'background-color', |
| 642 |
], |
| 643 |
]); |
| 644 |
|
| 645 |
// Configure Border Section for Coupon Input Field. |
| 646 |
$coupon_section->borderSection(__('Coupon Form Input Field Border', 'wpfnl'), $coupon_input_field, $this); |
| 647 |
|
| 648 |
// Configure Padding for Coupon Input Field. |
| 649 |
$coupon_section->addPreset('padding', 'coupon_input_field_padding', __('Coupon Form Input Field Padding', 'wpfnl'), $coupon_input_field)->whiteList(); |
| 650 |
|
| 651 |
// Configure Coupon Button Style. |
| 652 |
$coupon_btn = '.wpfnl-checkout .checkout_coupon.woocommerce-form-coupon button[type=submit]'; |
| 653 |
|
| 654 |
// Configure Padding for Coupon Button. |
| 655 |
$coupon_section->addPreset('padding', 'coupon_btn_padding', __('Coupon Button Padding', 'wpfnl'), $coupon_btn)->whiteList(); |
| 656 |
|
| 657 |
// Configure Background Color for Coupon Button. |
| 658 |
$coupon_section->addStyleControls([ |
| 659 |
[ |
| 660 |
'name' => __('Coupon Button Background Color', 'wpfnl'), |
| 661 |
'selector' => $coupon_btn, |
| 662 |
'property' => 'background-color', |
| 663 |
], |
| 664 |
]); |
| 665 |
|
| 666 |
// Configure Hover Background Color for Coupon Button. |
| 667 |
$coupon_section->addStyleControls([ |
| 668 |
[ |
| 669 |
'name' => __('Coupon Button Hover Background Color', 'wpfnl'), |
| 670 |
'selector' => $coupon_btn . ':hover', |
| 671 |
'property' => 'background-color', |
| 672 |
], |
| 673 |
]); |
| 674 |
|
| 675 |
// Configure Hover Text Color for Coupon Button. |
| 676 |
$coupon_section->addStyleControls([ |
| 677 |
[ |
| 678 |
'name' => __('Coupon Button Hover Text Color', 'wpfnl'), |
| 679 |
'selector' => $coupon_btn . ':hover', |
| 680 |
'property' => 'color', |
| 681 |
], |
| 682 |
]); |
| 683 |
|
| 684 |
// Configure Typography for Coupon Button. |
| 685 |
$coupon_section->typographySection(__('Coupon Button Typography', 'wpfnl'), $coupon_btn, $this); |
| 686 |
|
| 687 |
// Configure Border Section for Coupon Button |
| 688 |
$coupon_section->borderSection(__('Coupon Button Border', 'wpfnl'), $coupon_btn, $this); |
| 689 |
} |
| 690 |
|
| 691 |
/** |
| 692 |
* Configure the styling for the multistep section on the checkout page. |
| 693 |
* |
| 694 |
* @since 2.8.2 |
| 695 |
*/ |
| 696 |
private function configure_multistep_style() { |
| 697 |
// Add Control Section for Multistep Section |
| 698 |
$multistep_section = $this->addControlSection('multistep_section', __('Multistep Section', 'wpfnl'), 'assets/icon.png', $this); |
| 699 |
$step_title = '.wpfnl-multistep .wpfnl-multistep-wizard li .step-title'; |
| 700 |
|
| 701 |
// Configure Typography for Step Title |
| 702 |
$multistep_section->typographySection(__('Step Title Typography', 'wpfnl'), $step_title, $this); |
| 703 |
|
| 704 |
// Configure Step Line Colors |
| 705 |
$multistep_section->addStyleControls([ |
| 706 |
[ |
| 707 |
'name' => __('Step Normal Line Color', 'wpfnl'), |
| 708 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-wizard:before', |
| 709 |
'property' => 'background-color', |
| 710 |
], |
| 711 |
[ |
| 712 |
'name' => __('Step Active/Completed Line Color', 'wpfnl'), |
| 713 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-wizard > li.completed:before, .wpfnl-multistep .wpfnl-multistep-wizard > li.current:before', |
| 714 |
'property' => 'background-color', |
| 715 |
], |
| 716 |
]); |
| 717 |
|
| 718 |
// Configure Step Box Background Colors |
| 719 |
$multistep_section->addStyleControls([ |
| 720 |
[ |
| 721 |
'name' => __('Step Box Normal Background Color', 'wpfnl'), |
| 722 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-wizard li .step-icon', |
| 723 |
'property' => 'background-color', |
| 724 |
], |
| 725 |
[ |
| 726 |
'name' => __('Step Box Active/Completed Background Color', 'wpfnl'), |
| 727 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-wizard li.completed .step-icon, .wpfnl-multistep .wpfnl-multistep-wizard li.current .step-icon', |
| 728 |
'property' => 'background-color', |
| 729 |
], |
| 730 |
]); |
| 731 |
|
| 732 |
// Configure Step Box Icon Colors |
| 733 |
$multistep_section->addStyleControls([ |
| 734 |
[ |
| 735 |
'name' => __('Step Box Icon Normal Color', 'wpfnl'), |
| 736 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-wizard li .step-icon svg path', |
| 737 |
'property' => 'fill', |
| 738 |
], |
| 739 |
[ |
| 740 |
'name' => __('Step Box Icon Active/Completed Color', 'wpfnl'), |
| 741 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-wizard li.completed .step-icon svg path, .wpfnl-multistep .wpfnl-multistep-wizard li.current .step-icon svg path', |
| 742 |
'property' => 'fill', |
| 743 |
], |
| 744 |
]); |
| 745 |
|
| 746 |
// Configure Step Box Borders |
| 747 |
$multistep_section->borderSection(__('Step Box Border', 'wpfnl'), '.wpfnl-multistep .wpfnl-multistep-wizard li .step-icon', $this); |
| 748 |
$multistep_section->borderSection(__('Step Box Active/Completed Border', 'wpfnl'), '.wpfnl-multistep .wpfnl-multistep-wizard li.completed .step-icon, .wpfnl-multistep .wpfnl-multistep-wizard li.current .step-icon', $this); |
| 749 |
|
| 750 |
// Add Control Section for Multistep Navigation |
| 751 |
$multistep_section_navigation = $this->addControlSection('multistep_section_navigation', __('Multistep Navigation', 'wpfnl'), 'assets/icon.png', $this); |
| 752 |
$multistep_nav = '.wpfnl-multistep .wpfnl-multistep-navigation button[type=button]'; |
| 753 |
|
| 754 |
// Configure Typography for Navigation Button |
| 755 |
$multistep_section_navigation->typographySection(__('Navigation Button Typography', 'wpfnl'), $multistep_nav, $this); |
| 756 |
|
| 757 |
// Configure Border Section for Navigation Button |
| 758 |
$multistep_section_navigation->borderSection(__('Navigation Button Border', 'wpfnl'), $multistep_nav, $this); |
| 759 |
|
| 760 |
// Configure Padding for Navigation Button |
| 761 |
$multistep_section_navigation->addPreset('padding', 'multistep_nav_padding', __('Navigation Button Padding', 'wpfnl'), $multistep_nav)->whiteList(); |
| 762 |
|
| 763 |
// Configure Navigation Button Background Colors |
| 764 |
$multistep_section_navigation->addStyleControls([ |
| 765 |
[ |
| 766 |
'name' => __('Navigation Button Background Color', 'wpfnl'), |
| 767 |
'selector' => $multistep_nav, |
| 768 |
'property' => 'background-color', |
| 769 |
], |
| 770 |
[ |
| 771 |
'name' => __('Navigation Button Hover Background Color', 'wpfnl'), |
| 772 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-navigation button[type=button]:not(:disabled):hover', |
| 773 |
'property' => 'background-color', |
| 774 |
], |
| 775 |
]); |
| 776 |
|
| 777 |
// Configure Navigation Button Text and Border Colors on Hover |
| 778 |
$multistep_section_navigation->addStyleControls([ |
| 779 |
[ |
| 780 |
'name' => __('Navigation Button Hover Color', 'wpfnl'), |
| 781 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-navigation button[type=button]:not(:disabled):hover', |
| 782 |
'property' => 'color', |
| 783 |
], |
| 784 |
[ |
| 785 |
'name' => __('Navigation Button Hover Border Color', 'wpfnl'), |
| 786 |
'selector' => '.wpfnl-multistep .wpfnl-multistep-navigation button[type=button]:not(:disabled):hover', |
| 787 |
'property' => 'border-color', |
| 788 |
], |
| 789 |
]); |
| 790 |
} |
| 791 |
|
| 792 |
function defaultCSS() {} |
| 793 |
} |