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

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