PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.4.2
ShopBuilder – WooCommerce Builder For Elementor v3.4.2
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / Controls / ReviewsSettings.php

ReviewsSettings.php in ShopBuilder – WooCommerce Builder For Elementor 3.4.2, at app/Elementor/Widgets/Controls/ReviewsSettings.php

539 lines 16.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main ReviewsSettings class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\Controls;
9
10 use Elementor\Controls_Manager;
11 use RadiusTheme\SB\Elementor\Helper\ControlHelper;
12
13 // Do not allow directly accessing this file.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit( 'This script cannot be accessed directly.' );
16 }
17
18 /**
19 * Product Review Settings class
20 */
21 class ReviewsSettings {
22 /**
23 * Widget Control Selectors
24 *
25 * @var array
26 */
27 private static $widget;
28 /**
29 * Widget Control Selectors
30 *
31 * @var array
32 */
33 private static $selectors = [];
34 /**
35 * Widget Field
36 *
37 * @param object $widget widget object.
38 *
39 * @return array
40 */
41 public static function widget_fields( $widget ) {
42 self::$widget = $widget;
43 self::$selectors = $widget->selectors;
44 $fields = self::heading_controls() +
45 self::review_style() +
46 ReviewsStarSettings::widget_fields( $widget ) +
47 self::review_form() +
48 self::form_button();
49 return $fields;
50 }
51 /**
52 * Widget Field
53 *
54 * @return array
55 */
56 public static function form_button() {
57 $alignment = ControlHelper::alignment();
58 unset( $alignment['justify'] );
59 $fields = [
60 'button_section_start' => [
61 'mode' => 'section_start',
62 'label' => esc_html__( 'Button', 'shopbuilder' ),
63 'tab' => 'style',
64 ],
65 'button_typography' => [
66 'mode' => 'group',
67 'type' => 'typography',
68 'label' => esc_html__( 'Typography', 'shopbuilder' ),
69 'selector' => self::$selectors['button_typography'],
70 ],
71 'submit_button_height' => [
72 'mode' => 'responsive',
73 'label' => esc_html__( 'Submit button height (px)', 'shopbuilder' ),
74 'type' => 'slider',
75 'size_units' => [ 'px' ],
76 'range' => [
77 'px' => [
78 'min' => 10,
79 'max' => 300,
80 'step' => 1,
81 ],
82 ],
83 'default' => [
84 'unit' => 'px',
85 'size' => 100,
86 ],
87 'selectors' => [
88 self::$selectors['submit_button_height'] => 'height: {{SIZE}}{{UNIT}}!important;',
89 ],
90 ],
91 'submit_button_alignment' => [
92 'label' => esc_html__( 'Alignment', 'shopbuilder' ),
93 'type' => 'choose',
94 'options' => $alignment,
95 'default' => 'left',
96 'selectors' => [
97 self::$selectors['submit_button_alignment']['text-align'] => 'text-align: {{VALUE}} !important;',
98 self::$selectors['submit_button_alignment']['float'] => 'float: none;',
99 ],
100 ],
101 'button_tabs_start' => [
102 'mode' => 'tabs_start',
103 ],
104 // Tab For normal view.
105 'button_normal' => [
106 'mode' => 'tab_start',
107 'label' => esc_html__( 'Normal', 'shopbuilder' ),
108 ],
109 'button_text_color_normal' => [
110 'label' => esc_html__( 'Color', 'shopbuilder' ),
111 'type' => 'color',
112
113 'separator' => 'default',
114 'selectors' => [
115 self::$selectors['button_text_color_normal'] => 'color: {{VALUE}};',
116 ],
117 ],
118 'button_bg_color_normal' => [
119 'label' => esc_html__( 'Background Color', 'shopbuilder' ),
120 'type' => 'color',
121 'alpha' => true,
122 'selectors' => [
123 self::$selectors['button_bg_color_normal'] => 'background-color: {{VALUE}};',
124 ],
125 ],
126 'button_border' => [
127 'mode' => 'group',
128 'type' => 'border',
129 'selector' => self::$selectors['button_border'],
130 'size_units' => [ 'px' ],
131 ],
132 'button_normal_end' => [
133 'mode' => 'tab_end',
134 ],
135 'button_hover' => [
136 'mode' => 'tab_start',
137 'label' => esc_html__( 'Hover', 'shopbuilder' ),
138 ],
139 'button_text_color_hover' => [
140 'label' => esc_html__( 'Color', 'shopbuilder' ),
141 'type' => 'color',
142
143 'separator' => 'default',
144 'selectors' => [
145 self::$selectors['button_text_color_hover'] => 'color: {{VALUE}};',
146 ],
147 ],
148 'button_bg_color_hover' => [
149 'label' => esc_html__( 'Background Color', 'shopbuilder' ),
150 'type' => 'color',
151 'alpha' => true,
152 'selectors' => [
153 self::$selectors['button_bg_color_hover'] => 'background-color: {{VALUE}};',
154 ],
155 ],
156 'button_border_hover_color' => [
157 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
158 'type' => 'color',
159
160 'selectors' => [
161 self::$selectors['button_border_hover_color'] => 'border-color: {{VALUE}};',
162 ],
163 ],
164 'button_hover_end' => [
165 'mode' => 'tab_end',
166 ],
167 'button_tabs_end' => [
168 'mode' => 'tabs_end',
169 ],
170 'button_border_radius' => [
171 'label' => esc_html__( 'Border Radius (px)', 'shopbuilder' ),
172 'type' => 'dimensions',
173 'mode' => 'responsive',
174 'size_units' => [ 'px' ],
175 'selectors' => [
176 self::$selectors['button_border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
177 ],
178 ],
179 'button_padding' => [
180 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ),
181 'type' => 'dimensions',
182 'mode' => 'responsive',
183 'size_units' => [ 'px' ],
184 'selectors' => [
185 self::$selectors['button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
186 ],
187 'separator' => 'before',
188 ],
189 'button_margin' => [
190 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ),
191 'type' => 'dimensions',
192 'mode' => 'responsive',
193 'size_units' => [ 'px' ],
194 'selectors' => [
195 self::$selectors['button_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
196 ],
197 ],
198 'button_section_end' => [
199 'mode' => 'section_end',
200 ],
201 ];
202 return $fields;
203 }
204 /**
205 * Widget Field
206 *
207 * @return array
208 */
209 public static function review_form() {
210 $fields = [
211 'form_section_start' => [
212 'mode' => 'section_start',
213 'label' => esc_html__( 'Review Form Heading', 'shopbuilder' ),
214 'tab' => 'style',
215 ],
216 'form_heading_typography' => [
217 'mode' => 'group',
218 'type' => 'typography',
219 'label' => esc_html__( 'Typography', 'shopbuilder' ),
220 'selector' => self::$selectors['form_heading_typography'],
221 ],
222 'form_heading_color' => [
223 'label' => esc_html__( 'Color', 'shopbuilder' ),
224 'type' => 'color',
225 'selectors' => [
226 self::$selectors['form_heading_color'] => 'color: {{VALUE}};',
227 ],
228 ],
229 'noform_heading_text_color' => [
230 'label' => esc_html__( 'No Form Text Color', 'shopbuilder' ),
231 'type' => 'color',
232 'selectors' => [
233 self::$selectors['noform_heading_color'] => 'color: {{VALUE}} !important;',
234 ],
235 ],
236 'noform_heading_color' => [
237 'label' => esc_html__( 'No Form Text Background Color', 'shopbuilder' ),
238 'type' => 'color',
239 'selectors' => [
240 self::$selectors['noform_heading_color'] => 'background-color: {{VALUE}} !important;',
241 ],
242 ],
243 'form_title_margin' => [
244 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ),
245 'type' => 'dimensions',
246 'mode' => 'responsive',
247 'size_units' => [ 'px' ],
248 'selectors' => [
249 self::$selectors['form_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;',
250 ],
251 'separator' => 'before',
252 ],
253 'formheading_section_end' => [
254 'mode' => 'section_end',
255 ],
256 'review_form_section_start' => [
257 'mode' => 'section_start',
258 'label' => esc_html__( 'Review Form', 'shopbuilder' ),
259 'tab' => 'style',
260 ],
261 'review_label_heading' => [
262 'type' => 'html',
263 'raw' => sprintf(
264 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
265 esc_html__( 'Input Label', 'shopbuilder' )
266 ),
267 'content_classes' => 'elementor-panel-heading-title',
268 'separator' => 'default',
269 ],
270 'input_label_typography' => [
271 'mode' => 'group',
272 'type' => 'typography',
273 'label' => esc_html__( 'Typography', 'shopbuilder' ),
274 'selector' => self::$selectors['input_label_typography'],
275 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
276 ],
277 'review_label_color' => [
278 'label' => esc_html__( 'Color', 'shopbuilder' ),
279 'type' => 'color',
280 'selectors' => [
281 self::$selectors['review_label_color'] => 'color: {{VALUE}} ',
282 ],
283 ],
284 'review_label_required' => [
285 'label' => esc_html__( 'Required Color', 'shopbuilder' ),
286 'type' => 'color',
287 'selectors' => [
288 self::$selectors['review_label_required'] => 'color: {{VALUE}}',
289 ],
290 ],
291 'review_input_heading' => [
292 'type' => 'html',
293 'raw' => sprintf(
294 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
295 esc_html__( 'Form Input', 'shopbuilder' )
296 ),
297 'content_classes' => 'elementor-panel-heading-title',
298 'separator' => 'before',
299 ],
300 'label_input_text_typography' => [
301 'mode' => 'group',
302 'type' => 'typography',
303 'label' => esc_html__( 'Typography', 'shopbuilder' ),
304 'selector' => self::$selectors['label_input_text_typography'],
305 ],
306 'review_input_color' => [
307 'label' => esc_html__( 'Color', 'shopbuilder' ),
308 'type' => 'color',
309 'selectors' => [
310 self::$selectors['review_input_color'] => 'color: {{VALUE}};',
311 ],
312 ],
313 'review_input_border_color' => [
314 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
315 'type' => 'color',
316 'selectors' => [
317 self::$selectors['review_input_border_color'] => 'border-color: {{VALUE}};',
318 ],
319 ],
320 'review_input_border_color_focus' => [
321 'label' => esc_html__( 'Focus Border Color', 'shopbuilder' ),
322 'type' => 'color',
323 'selectors' => [
324 self::$selectors['review_input_border_color_focus'] => 'border-color: {{VALUE}} !important;outline-color: {{VALUE}} !important;',
325 ],
326 ],
327 'review_comment_field_height' => [
328 'mode' => 'responsive',
329 'label' => esc_html__( 'Comment field height (px)', 'shopbuilder' ),
330 'type' => 'slider',
331 'size_units' => [ 'px' ],
332 'range' => [
333 'px' => [
334 'min' => 50,
335 'max' => 300,
336 'step' => 1,
337 ],
338 ],
339 'default' => [
340 'unit' => 'px',
341 'size' => 100,
342 ],
343 'selectors' => [
344 self::$selectors['review_comment_field_height'] => 'height: {{SIZE}}{{UNIT}}!important;',
345 ],
346 ],
347 'review_form_rating_size' => [
348 'mode' => 'responsive',
349 'label' => esc_html__( 'Rating icon size (px)', 'shopbuilder' ),
350 'type' => 'slider',
351 'size_units' => [ 'px' ],
352 'range' => [
353 'px' => [
354 'min' => 10,
355 'max' => 100,
356 'step' => 1,
357 ],
358 ],
359 'selectors' => [
360 self::$selectors['review_form_rating_size'] => 'font-size: {{SIZE}}{{UNIT}};',
361 ],
362 ],
363 'review_field_spacing' => [
364 'label' => esc_html__( 'Field Spacing (px)', 'shopbuilder' ),
365 'type' => 'slider',
366 'size_units' => [ 'px' ],
367 'range' => [
368 'px' => [
369 'min' => 0,
370 'max' => 100,
371 'step' => 1,
372 ],
373 ],
374 'default' => [
375 'unit' => 'px',
376 'size' => 15,
377 ],
378 'selectors' => [
379 self::$selectors['review_field_spacing']['margin-0'] => 'margin: 0;',
380 self::$selectors['review_field_spacing']['margin-buttom'] => 'margin-bottom: {{SIZE}}{{UNIT}}!important;',
381 ],
382 ],
383 'review_input_border_radius' => [
384 'label' => esc_html__( 'Inputs Border Radius (px)', 'shopbuilder' ),
385 'type' => 'slider',
386 'size_units' => [ 'px' ],
387 'range' => [
388 'px' => [
389 'min' => 0,
390 'max' => 100,
391 'step' => 1,
392 ],
393 ],
394 'default' => [
395 'unit' => 'px',
396 'size' => 0,
397 ],
398 'selectors' => [
399 self::$selectors['review_input_border_radius'] => 'border-radius: {{SIZE}}{{UNIT}};',
400 ],
401 ],
402 'review_input_padding' => [
403 'label' => esc_html__( 'Inputs Padding (px)', 'shopbuilder' ),
404 'type' => 'dimensions',
405 'mode' => 'responsive',
406 'size_units' => [ 'px' ],
407 'selectors' => [
408 self::$selectors['review_input_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
409 ],
410 ],
411 'review_form_section_end' => [
412 'mode' => 'section_end',
413 ],
414 ];
415 return $fields;
416 }
417 /**
418 * Widget Field
419 *
420 * @return array
421 */
422 public static function heading_controls() {
423 $fields = [
424 'heading_section_start' => [
425 'mode' => 'section_start',
426 'label' => esc_html__( 'Review Heading', 'shopbuilder' ),
427 'tab' => 'style',
428 ],
429 'review_heading_typography' => [
430 'mode' => 'group',
431 'type' => 'typography',
432 'label' => esc_html__( 'Typography', 'shopbuilder' ),
433 'selector' => self::$selectors['review_heading_typography'],
434 ],
435 'review_heading_color' => [
436 'label' => esc_html__( 'Color', 'shopbuilder' ),
437 'type' => 'color',
438
439 'selectors' => [
440 self::$selectors['review_heading_color'] => 'color: {{VALUE}};',
441 ],
442 ],
443 'review_title_margin' => [
444 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ),
445 'type' => 'dimensions',
446 'mode' => 'responsive',
447 'size_units' => [ 'px' ],
448 'selectors' => [
449 self::$selectors['review_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;',
450 ],
451 'separator' => 'before',
452 ],
453 'heading_section_end' => [
454 'mode' => 'section_end',
455 ],
456 ];
457 return $fields;
458 }
459 /**
460 * Widget Field
461 *
462 * @return array
463 */
464 public static function review_style() {
465 $fields = [
466 'review_style_start' => [
467 'mode' => 'section_start',
468 'label' => esc_html__( 'Review Style', 'shopbuilder' ),
469 'tab' => 'style',
470 ],
471 'review_meta_color' => [
472 'label' => esc_html__( 'Meta Color', 'shopbuilder' ),
473 'type' => 'color',
474 'separator' => 'default',
475 'description' => esc_html__( 'Date, Author', 'shopbuilder' ),
476 'selectors' => [
477 self::$selectors['review_meta_color'] => 'color: {{VALUE}};',
478 ],
479 ],
480 'description_color' => [
481 'label' => esc_html__( 'Description Color', 'shopbuilder' ),
482 'type' => 'color',
483 'selectors' => [
484 self::$selectors['description_color'] => 'color: {{VALUE}};',
485 ],
486 ],
487 'review_border' => [
488 'mode' => 'group',
489 'type' => 'border',
490 'selector' => self::$selectors['review_border'],
491 'size_units' => [ 'px' ],
492 ],
493 'review_meta_typography' => [
494 'mode' => 'group',
495 'type' => 'typography',
496 'label' => esc_html__( 'Meta Typography', 'shopbuilder' ),
497 'selector' => self::$selectors['review_meta_typography'],
498 ],
499 'review_desc_typography' => [
500 'mode' => 'group',
501 'type' => 'typography',
502 'label' => esc_html__( 'Description Typography', 'shopbuilder' ),
503 'selector' => self::$selectors['review_desc_typography'],
504 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
505 ],
506 'review_padding' => [
507 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ),
508 'type' => 'dimensions',
509 'mode' => 'responsive',
510 'size_units' => [ 'px' ],
511 'selectors' => [
512 self::$selectors['review_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
513 ],
514 'separator' => 'before',
515 ],
516 'review_single_spacing' => [
517 'label' => esc_html__( 'Single Review Spacing (px)', 'shopbuilder' ),
518 'type' => 'slider',
519 'size_units' => [ 'px' ],
520 'range' => [
521 'px' => [
522 'min' => 0,
523 'max' => 100,
524 'step' => 1,
525 ],
526 ],
527 'selectors' => [
528 self::$selectors['review_single_spacing'] => 'margin-bottom: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};',
529 ],
530 'separator' => 'before',
531 ],
532 'review_style_end' => [
533 'mode' => 'section_end',
534 ],
535 ];
536 return $fields;
537 }
538 }
539