PluginProbe
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder / 51.1.63
King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder v51.1.63
51.1.86 51.1.84 51.1.85 51.1.83 51.1.82 51.1.81 51.1.79 51.1.78 51.1.77 51.1.76 51.1.74 51.1.75 51.1.65 51.1.64 51.1.63 trunk 51.1.14 51.1.2 51.1.35 51.1.36 51.1.37 51.1.38 51.1.39 51.1.44 51.1.45 All 40 releases
king-addons / includes / widgets / Woo_Checkout_Place_Order / Woo_Checkout_Place_Order.php

Woo_Checkout_Place_Order.php in King Addons for Elementor – 100+ Elementor Widgets, 4 000+ Elementor Templates, WooCommerce Builder, Mega Menu, Popup Builder 51.1.63, at includes/widgets/Woo_Checkout_Place_Order/Woo_Checkout_Place_Order.php

227 lines 5.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Woo Checkout Place Order Button widget.
4 *
5 * @package King_Addons
6 */
7
8 namespace King_Addons;
9
10 use Elementor\Controls_Manager;
11 use Elementor\Group_Control_Border;
12 use Elementor\Group_Control_Box_Shadow;
13 use Elementor\Group_Control_Typography;
14
15 if (!defined('ABSPATH')) {
16 exit;
17 }
18
19 /**
20 * Renders standalone place order button.
21 */
22 class Woo_Checkout_Place_Order extends Abstract_Checkout_Widget
23 {
24 /**
25 * Widget slug.
26 *
27 * @return string
28 */
29 public function get_name(): string
30 {
31 return 'woo_checkout_place_order';
32 }
33
34 /**
35 * Widget title.
36 *
37 * @return string
38 */
39 public function get_title(): string
40 {
41 return esc_html__('Checkout Place Order Button', 'king-addons');
42 }
43
44 /**
45 * Widget icon.
46 *
47 * @return string
48 */
49 public function get_icon(): string
50 {
51 return 'eicon-button';
52 }
53
54 /**
55 * Widget categories.
56 *
57 * @return array<int, string>
58 */
59 public function get_categories(): array
60 {
61 return ['king-addons-woo-builder'];
62 }
63
64 /**
65 * Styles.
66 *
67 * @return array<int, string>
68 */
69 public function get_style_depends(): array
70 {
71 return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-woo-checkout-place-order-style'];
72 }
73
74 /**
75 * Register controls.
76 *
77 * @return void
78 */
79 protected function register_controls(): void
80 {
81 $this->start_controls_section(
82 'section_content',
83 [
84 'label' => esc_html__('Button', 'king-addons'),
85 'tab' => Controls_Manager::TAB_CONTENT,
86 ]
87 );
88
89 $this->add_control(
90 'text',
91 [
92 'label' => esc_html__('Text', 'king-addons'),
93 'type' => Controls_Manager::TEXT,
94 'default' => esc_html__('Place order', 'king-addons'),
95 ]
96 );
97
98 $this->add_control(
99 'full_width',
100 [
101 'label' => esc_html__('Full width', 'king-addons'),
102 'type' => Controls_Manager::SWITCHER,
103 'return_value' => 'yes',
104 'default' => 'yes',
105 ]
106 );
107
108 $this->end_controls_section();
109
110 $this->start_controls_section(
111 'section_style',
112 [
113 'label' => esc_html__('Style', 'king-addons'),
114 'tab' => Controls_Manager::TAB_STYLE,
115 ]
116 );
117
118 $this->add_group_control(
119 Group_Control_Typography::get_type(),
120 [
121 'name' => 'typography',
122 'selector' => '{{WRAPPER}} .ka-woo-checkout-place-order__btn',
123 ]
124 );
125
126 $this->add_control(
127 'text_color',
128 [
129 'label' => esc_html__('Text Color', 'king-addons'),
130 'type' => Controls_Manager::COLOR,
131 'selectors' => [
132 '{{WRAPPER}} .ka-woo-checkout-place-order__btn' => 'color: {{VALUE}};',
133 ],
134 ]
135 );
136
137 $this->add_control(
138 'bg_color',
139 [
140 'label' => esc_html__('Background', 'king-addons'),
141 'type' => Controls_Manager::COLOR,
142 'selectors' => [
143 '{{WRAPPER}} .ka-woo-checkout-place-order__btn' => 'background: {{VALUE}};',
144 ],
145 ]
146 );
147
148 $this->add_control(
149 'text_color_hover',
150 [
151 'label' => esc_html__('Text Color Hover', 'king-addons'),
152 'type' => Controls_Manager::COLOR,
153 'selectors' => [
154 '{{WRAPPER}} .ka-woo-checkout-place-order__btn:hover' => 'color: {{VALUE}};',
155 ],
156 ]
157 );
158
159 $this->add_control(
160 'bg_color_hover',
161 [
162 'label' => esc_html__('Background Hover', 'king-addons'),
163 'type' => Controls_Manager::COLOR,
164 'selectors' => [
165 '{{WRAPPER}} .ka-woo-checkout-place-order__btn:hover' => 'background: {{VALUE}};',
166 ],
167 ]
168 );
169
170 $this->add_group_control(
171 Group_Control_Border::get_type(),
172 [
173 'name' => 'border',
174 'selector' => '{{WRAPPER}} .ka-woo-checkout-place-order__btn',
175 ]
176 );
177
178 $this->add_group_control(
179 Group_Control_Box_Shadow::get_type(),
180 [
181 'name' => 'shadow',
182 'selector' => '{{WRAPPER}} .ka-woo-checkout-place-order__btn',
183 ]
184 );
185
186 $this->add_control(
187 'padding',
188 [
189 'label' => esc_html__('Padding', 'king-addons'),
190 'type' => Controls_Manager::DIMENSIONS,
191 'size_units' => ['px', 'em', '%'],
192 'selectors' => [
193 '{{WRAPPER}} .ka-woo-checkout-place-order__btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
194 ],
195 ]
196 );
197
198 $this->end_controls_section();
199 }
200
201 /**
202 * Render widget output.
203 *
204 * @return void
205 */
206 protected function render(): void
207 {
208 if (!$this->should_render()) {
209 $this->render_missing_checkout_notice();
210 return;
211 }
212
213 $settings = $this->get_settings_for_display();
214 $text = $settings['text'] ?? esc_html__('Place order', 'king-addons');
215 $classes = ['ka-woo-checkout-place-order__btn', 'button', 'alt'];
216 if (!empty($settings['full_width'])) {
217 $classes[] = 'ka-woo-checkout-place-order__btn--full';
218 }
219
220 echo '<button type="submit" class="' . esc_attr(implode(' ', $classes)) . '" form="checkout">' . esc_html($text) . '</button>';
221 }
222 }
223
224
225
226
227