PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
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 / General / InfoBox / Controls.php

Controls.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.6, at app/Elementor/Widgets/General/InfoBox/Controls.php

926 lines 31.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Controls class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\General\InfoBox;
9
10 use RadiusTheme\SB\Helpers\Fns;
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 * Settings class.
20 *
21 * @package RadiusTheme\SB
22 */
23 class Controls {
24 /**
25 * Content section
26 *
27 * @param object $obj Reference object.
28 *
29 * @return array
30 */
31 public static function content( $obj ) {
32 return array_merge(
33 self::preset( $obj ),
34 self::info_box_icon( $obj ),
35 self::info_box_title( $obj ),
36 self::info_box_count( $obj ),
37 self::info_box_content( $obj ),
38 self::info_box_button( $obj ),
39 );
40 }
41
42 /**
43 * Style section
44 *
45 * @param object $obj Reference object.
46 *
47 * @return array
48 */
49 public static function style( $obj ) {
50 return array_merge(
51 self::content_box_style( $obj ),
52 self::icon_box_style( $obj ),
53 self::title_style( $obj ),
54 self::content_style( $obj ),
55 self::button_style( $obj, 'primary' ),
56 );
57 }
58
59 /**
60 * Preset section
61 *
62 * @param object $obj Reference object.
63 *
64 * @return array
65 */
66 private static function preset( $obj ) {
67 $fields['info_box_preset'] = $obj->start_section(
68 esc_html__( 'Layout', 'shopbuilder' ),
69 'content'
70 );
71 $fields['layout_note'] = $obj->el_heading( esc_html__( 'Predefined Layouts', 'shopbuilder' ) );
72 $fields['layout_style'] = [
73 'type' => 'rtsb-image-selector',
74 'options' => ControlHelper::general_widgets_info_box_layouts(),
75 'default' => 'rtsb-info-box-layout1',
76 ];
77
78 $fields['sb_button_hover_effect_note'] = $obj->el_heading( esc_html__( 'Button Hover Effect Preset', 'shopbuilder' ), 'before' );
79 $fields['button_hover_effects'] = [
80 'type' => 'rtsb-image-selector',
81 'options' => ControlHelper::general_widgets_button_hover_effect_preset(),
82 'default' => 'rtsb-sb-button-hover-effect-default',
83 ];
84 $fields['hover_animation'] = [
85 'mode' => 'responsive',
86 'type' => 'choose',
87 'label' => esc_html__( 'Hover Animation', 'shopbuilder' ),
88 'options' => [
89 'left' => [
90 'title' => esc_html__( 'Left', 'shopbuilder' ),
91 'icon' => 'eicon-h-align-left',
92 ],
93 'top' => [
94 'title' => esc_html__( 'Top', 'shopbuilder' ),
95 'icon' => 'eicon-v-align-top',
96 ],
97 'right' => [
98 'title' => esc_html__( 'Right', 'shopbuilder' ),
99 'icon' => 'eicon-h-align-right',
100 ],
101
102 ],
103 'toggle' => true,
104 'default' => 'left',
105 'condition' => [
106 'button_hover_effects' => [ 'rtsb-sb-button-hover-effect-preset2' ],
107 ],
108 ];
109 $fields['info_box_preset_end'] = $obj->end_section();
110 return $fields;
111 }
112
113 /**
114 * Title section
115 *
116 * @param object $obj Reference object.
117 *
118 * @return array
119 */
120 private static function info_box_title( $obj ) {
121 $fields['info_box_title_sec_start'] = $obj->start_section(
122 esc_html__( 'Title', 'shopbuilder' ),
123 'content'
124 );
125 $fields['info_box_title_html_tag'] = [
126 'label' => esc_html__( 'Title Tag', 'shopbuilder' ),
127 'description' => esc_html__( 'Please select the title tag.', 'shopbuilder' ),
128 'type' => 'select',
129 'options' => ControlHelper::heading_tags(),
130 'default' => 'h2',
131 'label_block' => true,
132 ];
133 $fields['info_box_title'] = [
134 'label' => esc_html__( 'Title', 'shopbuilder' ),
135 'description' => esc_html__( 'Please enter the title text.', 'shopbuilder' ),
136 'type' => 'textarea',
137 'label_block' => true,
138 'default' => __( 'ShopBuilder for Easy Store Customization', 'shopbuilder' ),
139 ];
140
141 $fields['info_box_title_sec_end'] = $obj->end_section();
142
143 return $fields;
144 }
145 /**
146 * Content section
147 *
148 * @param object $obj Reference object.
149 *
150 * @return array
151 */
152 private static function info_box_content( $obj ) {
153 $condition = [
154 'display_content' => 'yes',
155 ];
156 $fields['info_box_content_sec_start'] = $obj->start_section(
157 esc_html__( 'Description', 'shopbuilder' ),
158 'content'
159 );
160 $fields['display_content'] = [
161 'label' => esc_html__( 'Show Content?', 'shopbuilder' ),
162 'description' => esc_html__( 'Switch on to show content.', 'shopbuilder' ),
163 'label_on' => esc_html__( 'On', 'shopbuilder' ),
164 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
165 'type' => 'switch',
166 'default' => 'yes',
167 ];
168 $fields['info_box_content'] = [
169 'label' => esc_html__( 'Content', 'shopbuilder' ),
170 'description' => esc_html__( 'Please enter the call to action description text.', 'shopbuilder' ),
171 'type' => 'wysiwyg',
172 'label_block' => true,
173 'default' => sprintf( '<p>%s</p>', esc_html__( 'ShopBuilder is a versatile plugin designed for Elementor Page Builder. This plugin helps you design and customize your online store easily, letting you create attractive product pages and improve the shopping experience for your customers.', 'shopbuilder' ) ),
174 'condition' => $condition,
175 ];
176 $fields['info_box_content_sec_end'] = $obj->end_section();
177
178 return $fields;
179 }
180 /**
181 * Count section
182 *
183 * @param object $obj Reference object.
184 *
185 * @return array
186 */
187 private static function info_box_count( $obj ) {
188 $condition = [
189 'display_count' => 'yes',
190 ];
191 $fields['info_box_count_sec_start'] = $obj->start_section(
192 esc_html__( 'Count', 'shopbuilder' ),
193 'content',
194 [],
195 [
196 'layout_style' => [ 'rtsb-info-box-layout4' ],
197 ]
198 );
199 $fields['display_count'] = [
200 'label' => esc_html__( 'Show Count?', 'shopbuilder' ),
201 'description' => esc_html__( 'Switch on to show count.', 'shopbuilder' ),
202 'label_on' => esc_html__( 'On', 'shopbuilder' ),
203 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
204 'type' => 'switch',
205 'default' => 'yes',
206 ];
207 $fields['info_box_count'] = [
208 'label' => esc_html__( 'Count Number', 'shopbuilder' ),
209 'description' => esc_html__( 'Please enter the count number for info box count.', 'shopbuilder' ),
210 'type' => 'text',
211 'label_block' => true,
212 'default' => '01',
213 'condition' => $condition,
214 ];
215 $fields['info_box_count_sec_end'] = $obj->end_section();
216
217 return $fields;
218 }
219 /**
220 * Button section
221 *
222 * @param object $obj Reference object.
223 *
224 * @return array
225 */
226 private static function info_box_button( $obj ) {
227 $condition = [
228 'display_button' => 'yes',
229 ];
230 $fields['info_box_button_sec_start'] = $obj->start_section(
231 esc_html__( 'Button', 'shopbuilder' ),
232 'content'
233 );
234 $fields['display_button'] = [
235 'label' => esc_html__( 'Show Button?', 'shopbuilder' ),
236 'description' => esc_html__( 'Switch on to show button.', 'shopbuilder' ),
237 'label_on' => esc_html__( 'On', 'shopbuilder' ),
238 'label_off' => esc_html__( 'Off', 'shopbuilder' ),
239 'type' => 'switch',
240 'default' => 'yes',
241 ];
242 $fields['sb_button_icon'] = [
243 'label' => esc_html__( 'Button Icon', 'shopbuilder' ),
244 'type' => 'icons',
245 'default' => [
246 'value' => 'fas fa-arrow-right',
247 'library' => 'fa-solid',
248 ],
249 'condition' => $condition,
250 ];
251 $fields['sb_button_icon_position'] = [
252 'mode' => 'responsive',
253 'type' => 'choose',
254 'label' => esc_html__( 'Position', 'shopbuilder' ),
255 'options' => [
256 'left' => [
257 'title' => esc_html__( 'Left', 'shopbuilder' ),
258 'icon' => 'eicon-h-align-left',
259 ],
260 'right' => [
261 'title' => esc_html__( 'Right', 'shopbuilder' ),
262 'icon' => 'eicon-h-align-right',
263 ],
264
265 ],
266 'toggle' => true,
267 'default' => 'right',
268 'condition' => $condition,
269 ];
270
271 $fields['sb_button_content'] = [
272 'label' => esc_html__( 'Text', 'shopbuilder' ),
273 'description' => esc_html__( 'Please enter the button text.', 'shopbuilder' ),
274 'type' => 'text',
275 'label_block' => true,
276 'default' => __( 'Read More', 'shopbuilder' ),
277 'condition' => $condition,
278 ];
279 $fields['sb_button_link'] = [
280 'type' => 'link',
281 'label' => esc_html__( 'Link', 'shopbuilder' ),
282 'description' => esc_html__( 'Please enter a button link.', 'shopbuilder' ),
283 'placeholder' => esc_html__( 'https://custom-link.com', 'shopbuilder' ),
284 'default' => [ 'url' => '#' ],
285 'options' => [ 'url', 'is_external', 'nofollow' ],
286 'condition' => $condition,
287 ];
288
289 $fields['info_box_button_sec_end'] = $obj->end_section();
290
291 return $fields;
292 }
293
294 /**
295 * Content Icon
296 *
297 * @param object $obj Reference object.
298 *
299 * @return array
300 */
301 public static function info_box_icon( $obj ) {
302 $alignment_options = ControlHelper::alignment();
303 unset( $alignment_options['justify'] );
304 $fields['info_box_content_icon_sec_start'] = $obj->start_section(
305 esc_html__( 'Icon', 'shopbuilder' ),
306 'content',
307 [],
308 );
309 $fields['info_box_icon_type'] = [
310 'label' => __( 'Icon Type', 'shopbuilder' ),
311 'type' => 'select',
312 'default' => 'icon',
313 'options' => [
314 'icon' => __( 'Icon', 'shopbuilder' ),
315 'image' => __( 'Image', 'shopbuilder' ),
316 ],
317 ];
318 $fields['info_box_icon'] = [
319 'label' => esc_html__( 'Icon', 'shopbuilder' ),
320 'type' => 'icons',
321 'default' => [
322 'value' => 'fas fa-code',
323 'library' => 'fa-solid',
324 ],
325 'condition' => [
326 'info_box_icon_type' => [ 'icon' ],
327 ],
328 ];
329 $fields['info_box_image'] = [
330 'type' => 'media',
331 'label' => esc_html__( 'Upload Image', 'shopbuilder' ),
332 'default' => [
333 'url' => \Elementor\Utils::get_placeholder_image_src(),
334 ],
335 'condition' => [
336 'info_box_icon_type' => [ 'image' ],
337 ],
338 ];
339 $fields['info_box_image_size'] = [
340 'type' => 'select2',
341 'label' => esc_html__( 'Select Image Size', 'shopbuilder' ),
342 'description' => esc_html__( 'Please select the image size.', 'shopbuilder' ),
343 'options' => Fns::get_image_sizes(),
344 'default' => 'full',
345 'label_block' => true,
346 'content_classes' => 'elementor-descriptor',
347 'condition' => [
348 'info_box_icon_type' => [ 'image' ],
349 ],
350 ];
351 $fields['info_box_img_dimension'] = [
352 'type' => 'image-dimensions',
353 'label' => esc_html__( 'Enter Custom Image Size', 'shopbuilder' ),
354 'label_block' => true,
355 'show_label' => true,
356 'default' => [
357 'width' => 400,
358 'height' => 400,
359 ],
360 'conditions' => [
361 'relation' => 'and',
362 'terms' => [
363 [
364 'name' => 'info_box_image_size',
365 'operator' => '==',
366 'value' => 'rtsb_custom',
367 ],
368 [
369 'name' => 'info_box_icon_type',
370 'operator' => '==',
371 'value' => 'image',
372 ],
373 ],
374 ],
375 ];
376 $fields['info_box_img_crop'] = [
377 'type' => 'select2',
378 'label' => esc_html__( 'Image Crop', 'shopbuilder' ),
379 'description' => esc_html__( 'Please click on "Apply" to update the image.', 'shopbuilder' ),
380 'options' => [
381 'soft' => esc_html__( 'Soft Crop', 'shopbuilder' ),
382 'hard' => esc_html__( 'Hard Crop', 'shopbuilder' ),
383 ],
384 'default' => 'hard',
385 'condition' => [
386 'info_box_icon_type' => [ 'image' ],
387 ],
388 ];
389
390 $fields['info_box-img_custom_dimension_note'] = [
391 'type' => 'html',
392 'raw' => sprintf(
393 '<span style="display: block; background: #fffbf1; padding: 10px; font-weight: 500; line-height: 1.4; color: #bd3a3a;border: 1px solid #bd3a3a;">%s</span>',
394 esc_html__( 'Please note that, if you enter image size larger than the actual image itself, the image sizes will fallback to the full image dimension.', 'shopbuilder' )
395 ),
396 'condition' => [
397 'info_box_icon_type' => [ 'image' ],
398 'info_box_image_size' => 'rtsb_custom',
399 ],
400
401 ];
402 $fields['info_box_icon_position'] = [
403 'mode' => 'responsive',
404 'type' => 'choose',
405 'separator' => 'before',
406 'label' => esc_html__( 'Icon Position', 'shopbuilder' ),
407 'options' => [
408 'float: left; margin-right: 30px;' => [
409 'title' => esc_html__( 'Left', 'shopbuilder' ),
410 'icon' => 'eicon-h-align-left',
411 ],
412 'float: none; display: block; margin: 0;' => [
413 'title' => esc_html__( 'Top', 'shopbuilder' ),
414 'icon' => 'eicon-v-align-top',
415 ],
416 'float: right !important; margin-right: 0; margin-left: 30px;' => [
417 'title' => esc_html__( 'Right', 'shopbuilder' ),
418 'icon' => 'eicon-h-align-right',
419 ],
420
421 ],
422 'selectors' => [ $obj->selectors['icon']['position'] => '{{VALUE}};' ],
423 'toggle' => true,
424 'default' => 'top',
425 'condition' => [
426 'layout_style!' => [ 'rtsb-info-box-layout4' ],
427 ],
428 ];
429 $fields['info_box_element_alignment'] = [
430 'mode' => 'responsive',
431 'type' => 'choose',
432 'label' => esc_html__( 'Element Alignment', 'shopbuilder' ),
433 'options' => $alignment_options,
434 'separator' => 'before',
435 'selectors' => [ $obj->selectors['layout']['alignment'] => 'text-align: {{VALUE}};' ],
436 'condition' => [
437 'layout_style!' => [ 'rtsb-info-box-layout4' ],
438 ],
439 ];
440
441 $fields['info_box_content_sec_icon_end'] = $obj->end_section();
442 return $fields;
443 }
444
445
446 /**
447 * Title style section
448 *
449 * @param object $obj Reference object.
450 *
451 * @return array
452 */
453 private static function title_style( $obj ) {
454 $css_selectors = $obj->selectors['title_style'];
455 $title = esc_html__( 'Title Style', 'shopbuilder' );
456 $selectors = [
457 'typography' => $css_selectors['typography'],
458 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
459 'border' => $css_selectors['border'],
460 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
461 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;' ],
462 ];
463
464 $fields = ControlHelper::general_elementor_style( 'info_box_title_style', $title, $obj, [], $selectors );
465
466 unset(
467 $fields['info_box_title_style_alignment'],
468 $fields['info_box_title_style_color_tabs'],
469 $fields['info_box_title_style_color_tab'],
470 $fields['info_box_title_style_bg_color'],
471 $fields['info_box_title_style_color_tab_end'],
472 $fields['info_box_title_style_hover_color_tab'],
473 $fields['info_box_title_style_hover_color'],
474 $fields['info_box_title_style_hover_bg_color'],
475 $fields['info_box_title_style_hover_color_tab_end'],
476 $fields['info_box_title_style_color_tabs_end'],
477 $fields['info_box_title_style_border_hover_color']
478 );
479 return $fields;
480 }
481
482 /**
483 * Content Box style section
484 *
485 * @param object $obj Reference object.
486 *
487 * @return array
488 */
489 private static function content_box_style( $obj ) {
490 $css_selectors = $obj->selectors['content_box_style'];
491 $title = esc_html__( 'Content Box Style', 'shopbuilder' );
492 $selectors = [
493 'typography' => $css_selectors['typography'],
494 'box_shadow' => $css_selectors['box_shadow'],
495 'hover_box_shadow' => $css_selectors['hover_box_shadow'],
496 'gradient_bg' => $css_selectors['gradient_bg'],
497 'bg_overlay' => $css_selectors['bg_overlay'],
498 'count_color' => [ $css_selectors['count_color'] => 'color: {{VALUE}};' ],
499 'border' => $css_selectors['border'],
500 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
501 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
502 ];
503
504 $fields = ControlHelper::general_elementor_style( 'info_box_content_box_style', $title, $obj, [], $selectors );
505
506 unset(
507 $fields['info_box_content_box_style_color'],
508 $fields['info_box_content_box_style_bg_color'],
509 $fields['info_box_content_box_style_alignment'],
510 $fields['info_box_content_box_style_color_tabs'],
511 $fields['info_box_content_box_style_color_tab'],
512 $fields['info_box_content_box_style_color_tab_end'],
513 $fields['info_box_content_box_style_hover_color_tab'],
514 $fields['info_box_content_box_style_hover_color'],
515 $fields['info_box_content_box_style_hover_bg_color'],
516 $fields['info_box_content_box_style_hover_color_tab_end'],
517 $fields['info_box_content_box_style_color_tabs_end'],
518 $fields['info_box_content_box_style_border_hover_color'],
519 $fields['info_box_content_box_style_margin']
520 );
521 $fields['info_box_content_box_style_border_note']['separator'] = 'default';
522 $fields['info_box_content_box_style_color_note']['separator'] = 'default';
523 $fields['info_box_content_box_style_typo_note']['raw'] = sprintf(
524 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
525 esc_html__( 'Count Typography', 'shopbuilder' )
526 );
527
528 $fields['info_box_content_box_style_typo_note']['condition'] = [
529 'layout_style' => [ 'rtsb-info-box-layout4' ],
530 'display_count' => 'yes',
531 ];
532 $fields['rtsb_el_info_box_content_box_style_typography']['condition'] = [
533 'layout_style' => [ 'rtsb-info-box-layout4' ],
534 'display_count' => 'yes',
535 ];
536 $extra_controls['info_box_content_box_style_border_radius'] = [
537 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
538 'type' => 'dimensions',
539 'mode' => 'responsive',
540 'size_units' => [ 'px' ],
541 'selectors' => $selectors['border_radius'],
542 ];
543 $fields = Fns::insert_controls( 'info_box_content_box_style_spacing_note', $fields, $extra_controls );
544 $extra_controls2['info_box_content_box_style_count_color'] = [
545 'label' => esc_html__( 'Count Color', 'shopbuilder' ),
546 'type' => 'color',
547 'selectors' => $selectors['count_color'],
548 'condition' => [
549 'layout_style' => [ 'rtsb-info-box-layout4' ],
550 'display_count' => 'yes',
551 ],
552 ];
553 $extra_controls2['info_box_content_box_style_gradient_bg'] = [
554 'label' => esc_html__( 'Background', 'shopbuilder' ),
555 'type' => 'background',
556 'mode' => 'group',
557 'selector' => $selectors['gradient_bg'],
558 ];
559 $extra_controls2['info_box_content_box_style_bg_overlay'] = [
560 'label' => esc_html__( 'Background Overlay', 'shopbuilder' ),
561 'type' => 'background',
562 'mode' => 'group',
563 'exclude' => [ 'image' ], // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
564 'selector' => $selectors['bg_overlay'],
565 'fields_options' => [
566 'background' => [
567 'label' => esc_html__( 'Overlay Background Type', 'shopbuilder' ),
568 ],
569 ],
570 ];
571 $extra_controls2['info_box_content_box_style_box_shadow'] = [
572 'type' => 'box-shadow',
573 'mode' => 'group',
574 'label' => esc_html__( 'Box Shadow', 'shopbuilder' ),
575 'selector' => $selectors['box_shadow'],
576 ];
577 $extra_controls2['info_box_content_box_style_hover_box_shadow'] = [
578 'type' => 'box-shadow',
579 'mode' => 'group',
580 'label' => esc_html__( 'Hover Box Shadow', 'shopbuilder' ),
581 'selector' => $selectors['hover_box_shadow'],
582 ];
583 $fields = Fns::insert_controls( 'info_box_content_box_style_color_note', $fields, $extra_controls2, true );
584
585 return $fields;
586 }
587 /**
588 * Content style section
589 *
590 * @param object $obj Reference object.
591 *
592 * @return array
593 */
594 private static function content_style( $obj ) {
595 $condition = [
596 'display_content' => 'yes',
597 ];
598 $css_selectors = $obj->selectors['content_style'];
599 $title = esc_html__( 'Description Style', 'shopbuilder' );
600 $selectors = [
601 'typography' => $css_selectors['typography'],
602 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
603 'border' => $css_selectors['border'],
604 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
605 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
606 ];
607
608 $fields = ControlHelper::general_elementor_style( 'info_box_content_style', $title, $obj, $condition, $selectors );
609
610 unset(
611 $fields['info_box_content_style_alignment'],
612 $fields['info_box_content_style_color_tabs'],
613 $fields['info_box_content_style_color_tab'],
614 $fields['info_box_content_style_bg_color'],
615 $fields['info_box_content_style_color_tab_end'],
616 $fields['info_box_content_style_hover_color_tab'],
617 $fields['info_box_content_style_hover_color'],
618 $fields['info_box_content_style_hover_bg_color'],
619 $fields['info_box_content_style_hover_color_tab_end'],
620 $fields['info_box_content_style_color_tabs_end'],
621 $fields['info_box_content_style_border_hover_color']
622 );
623
624 return $fields;
625 }
626 /**
627 * Button style section
628 *
629 * @param object $obj Reference object.
630 *
631 * @return array
632 */
633 private static function button_style( $obj, $type = 'primary' ) {
634 $condition = [
635 'display_button' => 'yes',
636 ];
637 $css_selectors = $obj->selectors[ $type . '_button_style' ];
638 $title = esc_html__( 'Button Style', 'shopbuilder' );
639 $selectors = [
640 'typography' => $css_selectors['typography'],
641 'icon_size' => [
642 $css_selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}};',
643 $css_selectors['icon_size']['svg'] => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};',
644 ],
645 'icon_gap' => [ $css_selectors['icon_gap'] => 'gap: {{SIZE}}{{UNIT}};' ],
646 'btn_width' => [ $css_selectors['btn_width'] => 'min-width: {{SIZE}}{{UNIT}};' ],
647 'btn_height' => [ $css_selectors['btn_height'] => 'height: {{SIZE}}{{UNIT}};' ],
648 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
649 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ],
650 'gradient_bg' => $css_selectors['gradient_bg'],
651 'hover_gradient_bg' => $css_selectors['hover_gradient_bg'],
652 'border' => $css_selectors['border'],
653 'box_shadow' => $css_selectors['box_shadow'],
654 'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ],
655 'padding' => [ $css_selectors['padding'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
656 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
657 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
658 ];
659
660 $fields = ControlHelper::general_elementor_style( 'sb_' . $type . '_button_style', $title, $obj, $condition, $selectors );
661 unset(
662 $fields[ 'sb_' . $type . '_button_style_bg_color' ],
663 $fields[ 'sb_' . $type . '_button_style_alignment' ],
664 $fields[ 'sb_' . $type . '_button_style_hover_bg_color' ],
665 );
666 $extra_controls[ 'sb_' . $type . '_button_style_border_radius' ] = [
667 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
668 'type' => 'dimensions',
669 'mode' => 'responsive',
670 'size_units' => [ 'px' ],
671 'selectors' => $selectors['border_radius'],
672 ];
673 $fields = Fns::insert_controls( 'sb_' . $type . '_button_style_spacing_note', $fields, $extra_controls );
674 $extra_controls2[ 'sb_' . $type . '_button_style_btn_width' ] = [
675 'type' => 'slider',
676 'mode' => 'responsive',
677 'label' => esc_html__( 'Button Width', 'shopbuilder' ),
678 'size_units' => [ 'px','%' ],
679 'range' => [
680 'px' => [
681 'min' => 10,
682 'max' => 1000,
683 ],
684 '%' => [
685 'min' => 0,
686 'max' => 100,
687 ],
688 ],
689 'selectors' => $selectors['btn_width'],
690 ];
691 $extra_controls2[ 'sb_' . $type . '_button_style_btn_height' ] = [
692 'type' => 'slider',
693 'mode' => 'responsive',
694 'label' => esc_html__( 'Button Height', 'shopbuilder' ),
695 'size_units' => [ 'px','%' ],
696 'range' => [
697 'px' => [
698 'min' => 10,
699 'max' => 1000,
700 ],
701 '%' => [
702 'min' => 0,
703 'max' => 100,
704 ],
705 ],
706 'selectors' => $selectors['btn_height'],
707 ];
708
709 $extra_controls2[ 'sb_' . $type . '_button_style_icon_size' ] = [
710 'type' => 'slider',
711 'mode' => 'responsive',
712 'label' => esc_html__( 'Icon Size', 'shopbuilder' ),
713 'size_units' => [ 'px' ],
714 'range' => [
715 'px' => [
716 'min' => 0,
717 'max' => 100,
718 ],
719 ],
720 'selectors' => $selectors['icon_size'],
721 ];
722 $extra_controls2[ 'sb_' . $type . '_button_style_icon_gap' ] = [
723 'type' => 'slider',
724 'mode' => 'responsive',
725 'label' => esc_html__( 'Icon Gap', 'shopbuilder' ),
726 'size_units' => [ 'px' ],
727 'range' => [
728 'px' => [
729 'min' => 0,
730 'max' => 100,
731 ],
732 ],
733 'selectors' => $selectors['icon_gap'],
734 ];
735 $extra_controls2[ 'sb_' . $type . '_button_style_box_shadow' ] = [
736 'type' => 'box-shadow',
737 'mode' => 'group',
738 'label' => esc_html__( 'Box Shadow', 'shopbuilder' ),
739 'selector' => $selectors['box_shadow'],
740 ];
741 $fields = Fns::insert_controls( 'sb_' . $type . '_button_style_spacing_note', $fields, $extra_controls2, true );
742
743 $extra_controls3[ 'sb_' . $type . '_button_style_gradient_bg' ] = [
744 'label' => esc_html__( 'Background', 'shopbuilder' ),
745 'type' => 'background',
746 'mode' => 'group',
747 'selector' => $selectors['gradient_bg'],
748 ];
749 $fields = Fns::insert_controls( 'sb_' . $type . '_button_style_color', $fields, $extra_controls3, true );
750
751 $extra_controls4[ 'sb_' . $type . '_button_style_hover_gradient_bg' ] = [
752 'label' => esc_html__( 'Hover Background', 'shopbuilder' ),
753 'type' => 'background',
754 'mode' => 'group',
755 'selector' => $selectors['hover_gradient_bg'],
756 ];
757 $fields = Fns::insert_controls( 'sb_' . $type . '_button_style_hover_color', $fields, $extra_controls4, true );
758
759 return $fields;
760 }
761 /**
762 * Icon style section
763 *
764 * @param object $obj Reference object.
765 *
766 * @return array
767 */
768 /**
769 * Content Box style section
770 *
771 * @param object $obj Reference object.
772 *
773 * @return array
774 */
775 private static function icon_box_style( $obj ) {
776 $css_selectors = $obj->selectors['info_box_icon_style'];
777 $title = esc_html__( 'Icon Style', 'shopbuilder' );
778 $selectors = [
779 'icon_size' => [
780 $css_selectors['icon_size']['font_size'] => 'font-size: {{SIZE}}{{UNIT}};',
781 $css_selectors['icon_size']['svg'] => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};',
782 ],
783 'box_shadow' => $css_selectors['box_shadow'],
784 'icon_width' => [ $css_selectors['icon_width'] => 'width: {{SIZE}}{{UNIT}};' ],
785 'icon_height' => [ $css_selectors['icon_height'] => 'height: {{SIZE}}{{UNIT}};' ],
786 'color' => [ $css_selectors['color'] => 'color: {{VALUE}};' ],
787 'border_top_color' => [ $css_selectors['border_top_color'] => '--rtsb-info-box-border-color: {{VALUE}};' ],
788 'hover_color' => [ $css_selectors['hover_color'] => 'color: {{VALUE}};' ],
789 'gradient_bg' => $css_selectors['gradient_bg'],
790 'hover_gradient_bg' => $css_selectors['hover_gradient_bg'],
791 'border_hover_color' => [ $css_selectors['border_hover_color'] => 'border-color: {{VALUE}};' ],
792 'border' => $css_selectors['border'],
793 'margin' => [ $css_selectors['margin'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
794 'border_radius' => [ $css_selectors['border_radius'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;' ],
795 ];
796
797 $fields = ControlHelper::general_elementor_style( 'info_box_icon_style', $title, $obj, [], $selectors );
798 unset(
799 $fields['info_box_icon_style_typo_note'],
800 $fields['rtsb_el_info_box_icon_style_typography'],
801 $fields['info_box_icon_style_bg_color'],
802 $fields['info_box_icon_style_hover_bg_color'],
803 $fields['info_box_icon_style_hover_gradient_bg'],
804 $fields['info_box_icon_style_alignment'],
805 $fields['info_box_icon_style_padding'],
806 );
807 $extra_controls['info_box_icon_border_layer'] = [
808 'label' => esc_html__( 'Border Layer', 'shopbuilder' ),
809 'type' => 'choose',
810 'options' => [
811 'color-left' => [
812 'title' => esc_html__( 'Left', 'shopbuilder' ),
813 'icon' => 'eicon-h-align-left',
814 ],
815 'color-top' => [
816 'title' => esc_html__( 'Top', 'shopbuilder' ),
817 'icon' => 'eicon-v-align-top',
818 ],
819 'color-bottom' => [
820 'title' => esc_html__( 'Bottom', 'shopbuilder' ),
821 'icon' => 'eicon-v-align-bottom',
822 ],
823 'color-right' => [
824 'title' => esc_html__( 'Right', 'shopbuilder' ),
825 'icon' => 'eicon-h-align-right',
826 ],
827
828 ],
829 'toggle' => true,
830 'default' => 'color-top',
831 'condition' => [
832 'layout_style' => [ 'rtsb-info-box-layout3' ],
833 ],
834 ];
835 $extra_controls['info_box_icon_style_border_top_color'] = [
836 'label' => esc_html__( 'Border Layer Color', 'shopbuilder' ),
837 'type' => 'color',
838 'selectors' => $selectors['border_top_color'],
839 'condition' => [
840 'layout_style' => [ 'rtsb-info-box-layout3' ],
841 ],
842 ];
843 $extra_controls['info_box_icon_style_border_radius'] = [
844 'label' => esc_html__( 'Border Radius', 'shopbuilder' ),
845 'type' => 'dimensions',
846 'mode' => 'responsive',
847 'size_units' => [ 'px' ],
848 'selectors' => $selectors['border_radius'],
849 ];
850 $extra_controls['info_box_icon_style_box_shadow'] = [
851 'type' => 'box-shadow',
852 'mode' => 'group',
853 'label' => esc_html__( 'Box Shadow', 'shopbuilder' ),
854 'selector' => $selectors['box_shadow'],
855 ];
856 $fields = Fns::insert_controls( 'info_box_icon_style_spacing_note', $fields, $extra_controls );
857 $extra_controls2['info_box_icon_style_icon_width'] = [
858 'type' => 'slider',
859 'mode' => 'responsive',
860 'label' => esc_html__( 'Icon Width', 'shopbuilder' ),
861 'size_units' => [ 'px','%' ],
862 'range' => [
863 'px' => [
864 'min' => 10,
865 'max' => 1000,
866 ],
867 '%' => [
868 'min' => 0,
869 'max' => 100,
870 ],
871 ],
872 'selectors' => $selectors['icon_width'],
873 ];
874 $extra_controls2['info_box_icon_style_icon_height'] = [
875 'type' => 'slider',
876 'mode' => 'responsive',
877 'label' => esc_html__( 'Icon Height', 'shopbuilder' ),
878 'size_units' => [ 'px','%' ],
879 'range' => [
880 'px' => [
881 'min' => 10,
882 'max' => 1000,
883 ],
884 '%' => [
885 'min' => 0,
886 'max' => 100,
887 ],
888 ],
889 'selectors' => $selectors['icon_height'],
890 ];
891
892 $extra_controls2['info_box_icon_style_icon_size'] = [
893 'type' => 'slider',
894 'mode' => 'responsive',
895 'label' => esc_html__( 'Icon Size', 'shopbuilder' ),
896 'size_units' => [ 'px' ],
897 'range' => [
898 'px' => [
899 'min' => 0,
900 'max' => 100,
901 ],
902 ],
903 'selectors' => $selectors['icon_size'],
904 ];
905
906 $fields = Fns::insert_controls( 'info_box_icon_style_spacing_note', $fields, $extra_controls2, true );
907 $extra_controls3['info_box_icon_style_gradient_bg'] = [
908 'label' => esc_html__( 'Background', 'shopbuilder' ),
909 'type' => 'background',
910 'mode' => 'group',
911 'selector' => $selectors['gradient_bg'],
912 ];
913 $fields = Fns::insert_controls( 'info_box_icon_style_color', $fields, $extra_controls3, true );
914
915 $extra_controls4['info_box_icon_style_hover_gradient_bg'] = [
916 'label' => esc_html__( 'Hover Background', 'shopbuilder' ),
917 'type' => 'background',
918 'mode' => 'group',
919 'selector' => $selectors['hover_gradient_bg'],
920 ];
921 $fields = Fns::insert_controls( 'info_box_icon_style_hover_color', $fields, $extra_controls4, true );
922
923 return $fields;
924 }
925 }
926