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

504 lines 15.4 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 'size_units' => [ 'px' ],
153 // 'separator' => 'before',
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 'size_units' => [ 'px' ],
162 'selectors' => [
163 self::$selectors['button_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
164 ],
165 'separator' => 'before',
166 ],
167 'button_margin' => [
168 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ),
169 'type' => 'dimensions',
170 'size_units' => [ 'px' ],
171 'selectors' => [
172 self::$selectors['button_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
173 ],
174 ],
175 'butotn_section_end' => [
176 'mode' => 'section_end',
177 ],
178 ];
179 return $fields;
180 }
181 /**
182 * Widget Field
183 *
184 * @return array
185 */
186 public static function review_form() {
187 $fields = [
188 'form_section_start' => [
189 'mode' => 'section_start',
190 'label' => esc_html__( 'Review Form Heading', 'shopbuilder' ),
191 'tab' => 'style',
192 ],
193 'form_heading_typography' => [
194 'mode' => 'group',
195 'type' => 'typography',
196 'label' => esc_html__( 'Typography', 'shopbuilder' ),
197 'selector' => self::$selectors['form_heading_typography'],
198 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ],
199 ],
200 'form_heading_color' => [
201 'label' => esc_html__( 'Color', 'shopbuilder' ),
202 'type' => 'color',
203 'selectors' => [
204 self::$selectors['form_heading_color'] => 'color: {{VALUE}};',
205 ],
206 ],
207 'form_title_margin' => [
208 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ),
209 'type' => 'dimensions',
210 'size_units' => [ 'px' ],
211 'selectors' => [
212 self::$selectors['form_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;',
213 ],
214 'separator' => 'before',
215 ],
216 'formheading_section_end' => [
217 'mode' => 'section_end',
218 ],
219 'review_form_section_start' => [
220 'mode' => 'section_start',
221 'label' => esc_html__( 'Review From', 'shopbuilder' ),
222 'tab' => 'style',
223 ],
224 'review_label_heading' => [
225 'type' => 'html',
226 'raw' => sprintf(
227 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
228 esc_html__( 'Input Label', 'shopbuilder' )
229 ),
230 'content_classes' => 'elementor-panel-heading-title',
231 'separator' => 'default',
232 ],
233 'input_label_typography' => [
234 'mode' => 'group',
235 'type' => 'typography',
236 'label' => esc_html__( 'Typography', 'shopbuilder' ),
237 'selector' => self::$selectors['input_label_typography'],
238 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ],
239 ],
240 'review_label_color' => [
241 'label' => esc_html__( 'Color', 'shopbuilder' ),
242 'type' => 'color',
243 'selectors' => [
244 self::$selectors['review_label_color'] => 'color: {{VALUE}} ',
245 ],
246 ],
247 'review_label_required' => [
248 'label' => esc_html__( 'Required Color', 'shopbuilder' ),
249 'type' => 'color',
250 'selectors' => [
251 self::$selectors['review_label_required'] => 'color: {{VALUE}}',
252 ],
253 ],
254 'review_input_heading' => [
255 'type' => 'html',
256 'raw' => sprintf(
257 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
258 esc_html__( 'Form Input', 'shopbuilder' )
259 ),
260 'content_classes' => 'elementor-panel-heading-title',
261 'separator' => 'before',
262 ],
263 'label_input_text_typography' => [
264 'mode' => 'group',
265 'type' => 'typography',
266 'label' => esc_html__( 'Typography', 'shopbuilder' ),
267 'selector' => self::$selectors['label_input_text_typography'],
268 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ],
269 ],
270 'review_input_color' => [
271 'label' => esc_html__( 'Color', 'shopbuilder' ),
272 'type' => 'color',
273 // 'separator' => 'default',
274 'selectors' => [
275 self::$selectors['review_input_color'] => 'color: {{VALUE}};',
276 ],
277 ],
278 'review_input_border_color' => [
279 'label' => esc_html__( 'Border Color', 'shopbuilder' ),
280 'type' => 'color',
281 'selectors' => [
282 self::$selectors['review_input_border_color'] => 'border-color: {{VALUE}};',
283 ],
284 ],
285 'review_input_border_color_focus' => [
286 'label' => esc_html__( 'Focus Border Color', 'shopbuilder' ),
287 'type' => 'color',
288 'selectors' => [
289 self::$selectors['review_input_border_color_focus'] => 'border-color: {{VALUE}} !important;outline-color: {{VALUE}} !important;',
290 ],
291 ],
292 'review_comment_field_height' => [
293 'mode' => 'responsive',
294 'label' => esc_html__( 'Comment field height (px)', 'shopbuilder' ),
295 'type' => 'slider',
296 'size_units' => [ 'px' ],
297 'range' => [
298 'px' => [
299 'min' => 50,
300 'max' => 300,
301 'step' => 1,
302 ],
303 ],
304 'default' => [
305 'unit' => 'px',
306 'size' => 100,
307 ],
308 'selectors' => [
309 self::$selectors['review_comment_field_height'] => 'height: {{SIZE}}{{UNIT}};',
310 ],
311 ],
312 'review_form_rating_size' => [
313 'mode' => 'responsive',
314 'label' => esc_html__( 'Rating icon size (px)', 'shopbuilder' ),
315 'type' => 'slider',
316 'size_units' => [ 'px' ],
317 'range' => [
318 'px' => [
319 'min' => 10,
320 'max' => 100,
321 'step' => 1,
322 ],
323 ],
324 'selectors' => [
325 self::$selectors['review_form_rating_size'] => 'font-size: {{SIZE}}{{UNIT}};',
326 ],
327 ],
328 'review_field_spacing' => [
329 'label' => esc_html__( 'Field Spacing (px)', 'shopbuilder' ),
330 'type' => 'slider',
331 'size_units' => [ 'px' ],
332 'range' => [
333 'px' => [
334 'min' => 0,
335 'max' => 100,
336 'step' => 1,
337 ],
338 ],
339 'default' => [
340 'unit' => 'px',
341 'size' => 15,
342 ],
343 'selectors' => [
344 self::$selectors['review_field_spacing']['margin-0'] => 'margin: 0;',
345 self::$selectors['review_field_spacing']['margin-buttom'] => 'margin-bottom: {{SIZE}}{{UNIT}}!important;',
346 ],
347 ],
348 'review_input_border_radius' => [
349 'label' => esc_html__( 'Inputs Border Radius (px)', 'shopbuilder' ),
350 'type' => 'slider',
351 'size_units' => [ 'px' ],
352 'range' => [
353 'px' => [
354 'min' => 0,
355 'max' => 100,
356 'step' => 1,
357 ],
358 ],
359 'default' => [
360 'unit' => 'px',
361 'size' => 0,
362 ],
363 'selectors' => [
364 self::$selectors['review_input_border_radius'] => 'border-radius: {{SIZE}}{{UNIT}};',
365 ],
366 ],
367 'review_input_padding' => [
368 'label' => esc_html__( 'Inputs Padding (px)', 'shopbuilder' ),
369 'type' => 'dimensions',
370 'size_units' => [ 'px' ],
371 'selectors' => [
372 self::$selectors['review_input_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
373 ],
374 ],
375 'review_form_section_end' => [
376 'mode' => 'section_end',
377 ],
378 ];
379 return $fields;
380 }
381 /**
382 * Widget Field
383 *
384 * @return array
385 */
386 public static function heading_controls() {
387 $fields = [
388 'heading_section_start' => [
389 'mode' => 'section_start',
390 'label' => esc_html__( 'Review Heading', 'shopbuilder' ),
391 'tab' => 'style',
392 ],
393 'review_heading_typography' => [
394 'mode' => 'group',
395 'type' => 'typography',
396 'label' => esc_html__( 'Typography', 'shopbuilder' ),
397 'selector' => self::$selectors['review_heading_typography'],
398 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ],
399 ],
400 'review_heading_color' => [
401 'label' => esc_html__( 'Color', 'shopbuilder' ),
402 'type' => 'color',
403
404 'selectors' => [
405 self::$selectors['review_heading_color'] => 'color: {{VALUE}};',
406 ],
407 ],
408 'review_title_margin' => [
409 'label' => esc_html__( 'Margin (px)', 'shopbuilder' ),
410 'type' => 'dimensions',
411 'size_units' => [ 'px' ],
412 'selectors' => [
413 self::$selectors['review_title_margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}; padding: 0;',
414 ],
415 'separator' => 'before',
416 ],
417 'heading_section_end' => [
418 'mode' => 'section_end',
419 ],
420 ];
421 return $fields;
422 }
423 /**
424 * Widget Field
425 *
426 * @return array
427 */
428 public static function review_style() {
429 $fields = [
430 'review_style_start' => [
431 'mode' => 'section_start',
432 'label' => esc_html__( 'Review Style', 'shopbuilder' ),
433 'tab' => 'style',
434 ],
435 'review_meta_color' => [
436 'label' => esc_html__( 'Meta Color', 'shopbuilder' ),
437 'type' => 'color',
438 'separator' => 'default',
439 'description' => esc_html__( 'Date, Author', 'shopbuilder' ),
440 'selectors' => [
441 self::$selectors['review_meta_color'] => 'color: {{VALUE}};',
442 ],
443 ],
444 'description_color' => [
445 'label' => esc_html__( 'Description Color', 'shopbuilder' ),
446 'type' => 'color',
447 'selectors' => [
448 self::$selectors['description_color'] => 'color: {{VALUE}};',
449 ],
450 ],
451 'review_border' => [
452 'mode' => 'group',
453 'type' => 'border',
454 'selector' => self::$selectors['review_border'],
455 'size_units' => [ 'px' ],
456 ],
457 'review_meta_typography' => [
458 'mode' => 'group',
459 'type' => 'typography',
460 'label' => esc_html__( 'Meta Typography', 'shopbuilder' ),
461 'selector' => self::$selectors['review_meta_typography'],
462 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ],
463 ],
464 'review_desc_typography' => [
465 'mode' => 'group',
466 'type' => 'typography',
467 'label' => esc_html__( 'Description Typography', 'shopbuilder' ),
468 'selector' => self::$selectors['review_desc_typography'],
469 'exclude' => [ 'font_family', 'text_decoration', 'font_style' ],
470 ],
471 'review_padding' => [
472 'label' => esc_html__( 'Padding (px)', 'shopbuilder' ),
473 'type' => 'dimensions',
474 'size_units' => [ 'px' ],
475 'selectors' => [
476 self::$selectors['review_padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
477 ],
478 'separator' => 'before',
479 ],
480 'review_single_spacing' => [
481 'label' => esc_html__( 'Single Review Spacing (px)', 'shopbuilder' ),
482 'type' => 'slider',
483 'size_units' => [ 'px' ],
484 'range' => [
485 'px' => [
486 'min' => 0,
487 'max' => 100,
488 'step' => 1,
489 ],
490 ],
491 'selectors' => [
492 self::$selectors['review_single_spacing'] => 'margin-bottom: {{SIZE}}{{UNIT}}; padding-bottom: {{SIZE}}{{UNIT}};',
493 ],
494 'separator' => 'before',
495 ],
496 'review_style_end' => [
497 'mode' => 'section_end',
498 ],
499 ];
500 return $fields;
501 }
502
503 }
504