PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.3
ShopBuilder – WooCommerce Builder For Elementor v3.2.3
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.2.3, at app/Elementor/Widgets/Controls/ReviewsSettings.php

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