PluginProbe ʕ •ᴥ•ʔ
ShopPress – Shop Builder for Elementor and WooCommerce / trunk
ShopPress – Shop Builder for Elementor and WooCommerce vtrunk
shop-press / Elementor / widgets / checkout / payment-method / config.php
shop-press / Elementor / widgets / checkout / payment-method Last commit date
config.php 2 years ago
config.php
178 lines
1 <?php
2 namespace ShopPress\Elementor\Widgets;
3
4 defined( 'ABSPATH' ) || exit;
5
6 use Elementor\Controls_Manager;
7 use ShopPress\Elementor\ShopPressWidgets;
8
9 class PaymentMethod extends ShopPressWidgets {
10
11 public function get_name() {
12 return 'sp-payment-method';
13 }
14
15 public function get_title() {
16 return __( 'Payment', 'shop-press' );
17 }
18
19 public function get_icon() {
20 return 'sp-widget sp-eicon-payment-method';
21 }
22
23 public function get_categories() {
24 return array( 'sp_woo_checkout' );
25 }
26
27 public function setup_styling_options() {
28 $this->register_group_styler(
29 'wrapper',
30 __( 'Wrapper', 'shop-press' ),
31 array(
32 'wrapper' => array(
33 'label' => esc_html__( 'Wrapper', 'shop-press' ),
34 'type' => 'styler',
35 'selector' => '#payment',
36 'wrapper' => '{{WRAPPER}}',
37 ),
38 )
39 );
40
41 $this->register_group_styler(
42 'payment_methods',
43 __( 'Payment Methods', 'shop-press' ),
44 array(
45 'payment_methods_wrapper' => array(
46 'label' => esc_html__( 'Wrapper', 'shop-press' ),
47 'type' => 'styler',
48 'selector' => '.wc_payment_methods',
49 'wrapper' => '{{WRAPPER}}',
50 ),
51 'payment_methods_items' => array(
52 'label' => esc_html__( 'Payment Method', 'shop-press' ),
53 'type' => 'styler',
54 'selector' => '.wc_payment_method',
55 'wrapper' => '{{WRAPPER}}',
56 ),
57 'payment_methods_input' => array(
58 'label' => esc_html__( 'Payment Method Input', 'shop-press' ),
59 'type' => 'styler',
60 'selector' => '.wc_payment_method input',
61 'wrapper' => '{{WRAPPER}}',
62 ),
63 'payment_methods_label' => array(
64 'label' => esc_html__( 'Payment Method Label', 'shop-press' ),
65 'type' => 'styler',
66 'selector' => '.wc_payment_method label',
67 'wrapper' => '{{WRAPPER}}',
68 ),
69 'payment_methods_box' => array(
70 'label' => esc_html__( 'Payment Box', 'shop-press' ),
71 'type' => 'styler',
72 'selector' => '#payment div.payment_box',
73 'wrapper' => '{{WRAPPER}}',
74 ),
75 )
76 );
77
78 $this->register_group_styler(
79 'place_order',
80 __( 'Place Order', 'shop-press' ),
81 array(
82 'place_order_wrapper' => array(
83 'label' => esc_html__( 'Wrapper', 'shop-press' ),
84 'type' => 'styler',
85 'selector' => '.form-row.place-order',
86 'wrapper' => '{{WRAPPER}}',
87 ),
88 'privacy_policy_wrapper' => array(
89 'label' => esc_html__( 'Privacy Policy Wrapper', 'shop-press' ),
90 'type' => 'styler',
91 'selector' => '.woocommerce-privacy-policy-text',
92 'wrapper' => '{{WRAPPER}}',
93 ),
94 'privacy_policy_text' => array(
95 'label' => esc_html__( 'Privacy Policy Text', 'shop-press' ),
96 'type' => 'styler',
97 'selector' => '.woocommerce-privacy-policy-text p',
98 'wrapper' => '{{WRAPPER}}',
99 ),
100 'privacy_policy_link' => array(
101 'label' => esc_html__( 'Privacy Policy Link', 'shop-press' ),
102 'type' => 'styler',
103 'selector' => '.woocommerce-privacy-policy-text a',
104 'wrapper' => '{{WRAPPER}}',
105 ),
106 'place_order_btn' => array(
107 'label' => esc_html__( 'Place Order Button', 'shop-press' ),
108 'type' => 'styler',
109 'selector' => '.place-order button#place_order',
110 'wrapper' => '{{WRAPPER}}',
111 ),
112 )
113 );
114 }
115
116 protected function register_controls() {
117 $this->start_controls_section(
118 'section_content',
119 array(
120 'label' => __( 'General', 'shop-press' ),
121 )
122 );
123
124 $this->add_control(
125 'hide_payment_title',
126 array(
127 'label' => __( 'Hide Title', 'shop-press' ),
128 'type' => Controls_Manager::SWITCHER,
129 )
130 );
131
132 $this->add_control(
133 'method_desc',
134 array(
135 'label' => __( 'Payment method description', 'shop-press' ),
136 'type' => Controls_Manager::SWITCHER,
137 'label_on' => __( 'Show', 'shop-press' ),
138 'label_off' => __( 'Hide', 'shop-press' ),
139 'return_value' => 'yes',
140 'default' => 'yes',
141 )
142 );
143
144 $this->add_control(
145 'policy_desc',
146 array(
147 'label' => __( 'Policy description', 'shop-press' ),
148 'type' => Controls_Manager::SWITCHER,
149 'label_on' => __( 'Show', 'shop-press' ),
150 'label_off' => __( 'Hide', 'shop-press' ),
151 'return_value' => 'yes',
152 'default' => 'yes',
153 )
154 );
155
156 $this->end_controls_section();
157 $this->setup_styling_options();
158
159 do_action( 'shoppress/elementor/widget/register_controls_init', $this );
160 }
161
162 protected function render() {
163 $settings = $this->get_settings_for_display();
164
165 do_action( 'shoppress/widget/before_render', $settings );
166
167 $args = array(
168 'hide_title' => $settings['hide_payment_title'],
169 'policy_desc' => $settings['policy_desc'],
170 'method_desc' => $settings['method_desc'],
171 );
172
173 if ( $this->checkout_editor_preview() ) {
174 sp_load_builder_template( 'checkout/checkout-payment-method', $args );
175 }
176 }
177 }
178