PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.1
ShopBuilder – WooCommerce Builder For Elementor v3.2.1
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 / Abstracts / ElementorWidgetBase.php

ElementorWidgetBase.php in ShopBuilder – WooCommerce Builder For Elementor 3.2.1, at app/Abstracts/ElementorWidgetBase.php

831 lines 20.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Main ElementorWidgetBase class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Abstracts;
9
10 use Elementor\Group_Control_Css_Filter;
11 use Elementor\Plugin;
12 use Elementor\Repeater;
13 use Elementor\Widget_Base;
14 use Elementor\Controls_Manager;
15 use Elementor\Group_Control_Border;
16 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
17 use RadiusTheme\SB\Helpers\BuilderFns;
18 use Elementor\Group_Control_Typography;
19 use Elementor\Group_Control_Background;
20 use Elementor\Group_Control_Box_Shadow;
21 use Elementor\Group_Control_Text_Shadow;
22 use Elementor\Group_Control_Text_Stroke;
23 use RadiusTheme\SB\Elementor\Helper\ControlSelectors;
24 use RadiusTheme\SB\Helpers\Fns;
25
26
27 // Do not allow directly accessing this file.
28 if ( ! defined( 'ABSPATH' ) ) {
29 exit( 'This script cannot be accessed directly.' );
30 }
31
32 /**
33 * Abstract ElementorWidgetBase Class
34 *
35 * Implemented by classes for elementor addons development.
36 *
37 * @version 1.0.0
38 * @package RadiusTheme\SB
39 */
40 abstract class ElementorWidgetBase extends Widget_Base {
41
42 /**
43 * Widget Title.
44 *
45 * @var String
46 */
47 public $rtsb_name;
48
49 /**
50 * Widget name.
51 *
52 * @var String
53 */
54 public $rtsb_base;
55
56 /**
57 * Widget categories.
58 *
59 * @var String
60 */
61 public $rtsb_category;
62
63 /**
64 * Widget icon class
65 *
66 * @var String
67 */
68 public $rtsb_icon;
69
70 /**
71 * PRO Label HTML.
72 *
73 * @var String
74 */
75 public $pro_label = '';
76
77 /**
78 * PRO content tab.
79 *
80 * @var String
81 */
82 public $pro_tab;
83
84 /**
85 * Widget prefix.
86 *
87 * @var String
88 */
89 public $el_prefix;
90
91 /**
92 * Widget controls.
93 *
94 * @var array
95 */
96 public $selectors = [];
97
98 /**
99 * Class Constructor
100 *
101 * @param array $data default data.
102 * @param array $args default arg.
103 */
104 public function __construct( $data = [], $args = null ) {
105 $this->apply_hooks_before_render();
106 parent::__construct( $data, $args );
107 $this->rtsb_category = 'rtsb-shopbuilder';
108 $this->rtsb_icon = 'rtsb-el-custom rtsb-element icon-' . $this->rtsb_base;
109 $this->el_prefix = 'rtsb_el_';
110 $this->pro_label = sprintf(
111 '<span class="rtsb-pro-label">%s</span>',
112 esc_html__( 'Pro', 'shopbuilder' )
113 );
114 $this->selectors = ControlSelectors::get_widget_selectors( $this );
115 }
116
117
118 /**
119 * Elementor controls marge all settings
120 *
121 * @return array
122 */
123 abstract public function widget_fields();
124
125 /**
126 * Get widget name.
127 *
128 * Retrieve widget name.
129 *
130 * @access public
131 *
132 * @return string Widget name.
133 */
134 public function get_name() {
135 return $this->rtsb_base;
136 }
137
138 /**
139 * Set Widget Keyword.
140 *
141 * @return array
142 */
143 public function get_keywords() {
144 return [ 'woocommerce', 'shopbuilder' ];
145 }
146
147 /**
148 * Get widget title.
149 *
150 * Retrieve widget title.
151 *
152 * @access public
153 *
154 * @return string Widget title.
155 */
156 public function get_title() {
157 return $this->rtsb_name;
158 }
159
160 /**
161 * Get widget icon.
162 *
163 * Retrieve widget icon.
164 *
165 * @return string Widget icon.
166 * @since 1.0.0
167 * @access public
168 */
169 public function get_icon() {
170 return $this->rtsb_icon;
171 }
172
173 /**
174 * Get widget categories.
175 *
176 * Retrieve the list of categories widget belongs to.
177 *
178 * @return array Widget categories.
179 * @since 1.0.0
180 * @access public
181 */
182 public function get_categories() {
183 return [ $this->rtsb_category ];
184 }
185
186 /**
187 * Elementor Promotional section controls.
188 *
189 * @return array
190 */
191 public function promo_content() {
192 if ( rtsb()->has_pro() || $this->widget_exceptions() ) {
193 return [];
194 }
195
196 $promo_fields = [];
197
198 $promo_fields['pro_alert'] = [
199 'mode' => 'section_start',
200 'label' => sprintf(
201 '<span style="color: #f54">%s</span>',
202 esc_html__( 'Go Premium for More Features', 'shopbuilder' )
203 ),
204 ];
205
206 if ( $this->pro_tab ) {
207 $promo_fields['pro_alert']['tab'] = $this->pro_tab;
208 }
209
210 $promo_fields['get_pro'] = [
211 'type' => 'html',
212 'raw' => '<div class="elementor-nerd-box rtsb-promo"><div class="elementor-nerd-box-title" style="margin-top: 0; margin-bottom: 20px;">Unlock more possibilities</div><div class="elementor-nerd-box-message"><span class="pro-feature" style="font-size: 13px;"> Get the <a href="' . esc_url( rtsb()->pro_version_link() ) . '" target="_blank" style="color: #f54">Pro version</a> for more stunning layouts and customization options.</span></div><a class="elementor-nerd-box-link elementor-button elementor-button-default elementor-button-go-pro" href="' . esc_url( rtsb()->pro_version_link() ) . '" target="_blank">Get Pro</a></div>',
213 'separator' => 'default',
214 ];
215
216 $promo_fields['pro_alert_end'] = [
217 'mode' => 'section_end',
218 ];
219
220 return $promo_fields;
221 }
222
223 /**
224 * Register widget controls.
225 *
226 * Adds different input fields to allow the user to change and customize the widget settings.
227 *
228 * @since 1.0.0
229 * @access protected
230 */
231 protected function register_controls() {
232 $this->theme_support( 'widget_controls' );
233 $the_widget = $this->widget_fields();
234 if ( ! is_array( $the_widget ) ) {
235 return;
236 }
237 $fields = array_merge( $the_widget, $this->promo_content() );
238
239 $fields = apply_filters( 'rtsb/elements/elementor/widgets/controls/' . $this->rtsb_base, $fields, $this );
240
241 foreach ( $fields as $id => $field ) {
242 $field['classes'] = ! empty( $field['classes'] ) ? $field['classes'] . ' elementor-control-rtsb_el' : ' elementor-control-rtsb_el';
243
244 if ( ! empty( $field['type'] ) ) {
245 $field['type'] = self::el_fields( $field['type'] );
246 }
247
248 if ( ! empty( $field['tab'] ) ) {
249 $field['tab'] = self::el_tabs( $field['tab'] );
250 }
251
252 if ( isset( $field['mode'] ) && 'section_start' === $field['mode'] ) {
253 unset( $field['mode'] );
254 unset( $field['separator'] );
255
256 $this->start_controls_section( $id, $field );
257 } elseif ( isset( $field['mode'] ) && 'section_end' === $field['mode'] ) {
258 $this->end_controls_section();
259 } elseif ( isset( $field['mode'] ) && 'tabs_start' === $field['mode'] ) {
260 unset( $field['mode'] );
261 unset( $field['separator'] );
262
263 $this->start_controls_tabs( $id );
264 } elseif ( isset( $field['mode'] ) && 'tabs_end' === $field['mode'] ) {
265 $this->end_controls_tabs();
266 } elseif ( isset( $field['mode'] ) && 'tab_start' === $field['mode'] ) {
267 unset( $field['mode'] );
268 unset( $field['separator'] );
269
270 $this->start_controls_tab( $id, $field );
271 } elseif ( isset( $field['mode'] ) && 'tab_end' === $field['mode'] ) {
272 $this->end_controls_tab();
273 } elseif ( isset( $field['mode'] ) && 'group' === $field['mode'] ) {
274 $type = $field['type'];
275 $field['name'] = $id;
276 unset( $field['mode'] );
277 unset( $field['type'] );
278 $this->add_group_control( $type, $field );
279 } elseif ( isset( $field['mode'] ) && 'responsive' === $field['mode'] ) {
280 unset( $field['mode'] );
281
282 $this->add_responsive_control( $id, $field );
283 } elseif ( isset( $field['mode'] ) && 'popover_start' === $field['mode'] ) {
284 unset( $field['mode'] );
285 unset( $field['separator'] );
286
287 $this->add_control( $id, $field );
288 $this->start_popover();
289 } elseif ( isset( $field['mode'] ) && 'popover_end' === $field['mode'] ) {
290 $this->end_popover();
291 } elseif ( isset( $field['mode'] ) && 'repeater' === $field['mode'] ) {
292 $repeater = new Repeater();
293 $repeater_fields = $field['fields'];
294
295 foreach ( $repeater_fields as $rf_id => $value ) {
296 if ( ! empty( $value['type'] ) ) {
297 $value['type'] = self::el_fields( $value['type'] );
298 }
299 if ( isset( $value['mode'] ) && 'responsive' === $value['mode'] ) {
300 unset( $value['mode'] );
301 $repeater->add_responsive_control( $rf_id, $value );
302 } elseif ( isset( $value['mode'] ) && 'group' === $value['mode'] ) {
303 $type = $value['type'];
304 $value['name'] = $rf_id;
305 unset( $value['mode'] );
306 unset( $value['type'] );
307 $repeater->add_group_control( $type, $value );
308 } else {
309 $repeater->add_control( $rf_id, $value );
310 }
311 }
312
313 $field['fields'] = $repeater->get_controls();
314
315 $this->add_control( $id, $field );
316 } else {
317 $this->add_control( $id, $field );
318 }
319 }
320
321 do_action( 'rtsb/after/register/controls' );
322 }
323
324 /**
325 * Elementor Edit mode.
326 *
327 * @return mixed
328 */
329 public function is_edit_mode() {
330 return Plugin::$instance->preview->is_preview_mode() || Plugin::$instance->editor->is_edit_mode();
331 }
332
333 /**
334 * Elementor Edit preview.
335 *
336 * @return mixed
337 */
338 public function is_builder_mode() {
339 return BuilderFns::is_builder_preview() || $this->is_edit_mode();
340 }
341
342 /**
343 * Elementor Edit mode need some extra js for isotop reinitialize
344 *
345 * @return void
346 */
347 public function editor_slider_script() {
348 if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
349 $selector = $this->get_unique_selector() . ' .rtsb-carousel-slider';
350 ?>
351 <script>
352 jQuery('<?php echo esc_attr( $selector ); ?>').rtsb_slider();
353 </script>
354 <?php
355 }
356 }
357
358 /**
359 * Elementor Edit mode need some extra js for isotop reinitialize
360 *
361 * @return void
362 */
363 public function editor_cart_icon_script() {
364 if ( $this->is_edit_mode() ) {
365 $selector = $this->get_unique_selector() . ' .has-cart-button';
366 ?>
367 <script type="text/javascript">
368 // Product Archive Catelog
369 (function ($) {
370 setTimeout( function (){
371 var cartWrpper = $('body').find('<?php echo esc_attr( $selector ); ?>');
372 var cartIcon = cartWrpper.attr('data-cart-icon');
373 var cartButton = cartWrpper.find(
374 '.product_type_grouped, .add_to_cart_button, .single_add_to_cart_button '
375 );
376 if (cartIcon) {
377 cartButton.find('i').remove();
378 cartButton.find('svg').remove();
379 cartButton.find('img').remove();
380 cartButton.prepend(cartIcon);
381 }
382 }, 2000);
383 })(jQuery);
384 </script>
385 <?php
386 }
387 }
388
389 /**
390 * Elementor Edit mode script
391 *
392 * @return void
393 */
394 public function edit_mode_script() {
395 if ( ! $this->is_edit_mode() ) {
396 return;
397 }
398 $ajaxurl = admin_url( 'admin-ajax.php' );
399
400 // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
401 if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
402 $ajaxurl = admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
403 }
404 ?>
405 <script>
406 var rtsb = {
407 ajaxurl: '<?php echo esc_url( $ajaxurl ); ?>',
408 nonce: '<?php echo esc_attr( wp_create_nonce( rtsb()->nonceId ) ); ?>',
409 is_pro: '<?php echo esc_attr( rtsb()->has_pro() ? 'true' : 'false' ); ?>',
410 isOptimizationEnabled: '<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>'
411 };
412
413 if (!rtsb.isOptimizationEnabled) {
414 rtsbElFrontend();
415
416 setTimeout(function() {
417 rtsbProductPageInit();
418 }, 1000);
419 } else {
420 if (typeof elementorFrontend !== 'undefined') {
421 window.waitForRTSB((RTSB) => {
422 RTSB.modules.get('elementorInit')?.refresh();
423 RTSB.modules.get('singleProductTabs')?.refresh();
424 RTSB.modules.get('reviewFormStar')?.refresh();
425 RTSB.modules.get('addCartIcon')?.refresh();
426 RTSB.modules.get('productImage')?.refresh();
427 RTSB.modules.get('CartQuantityHandler')?.refresh();
428 });
429 }
430 }
431
432 <?php if ( rtsb()->has_pro() ) { ?>
433 var isMasonry = jQuery('.rtsb-elementor-container .rtsb-masonry');
434
435 if(isMasonry.length > 0) {
436 isMasonry.masonry();
437 }
438
439 if (!'<?php echo esc_attr( Fns::is_optimization_enabled() ); ?>') {
440 if (typeof rtsbFilters === 'function') {
441 rtsbFilters();
442 }
443
444 setTimeout( function (){
445 window.rtsbCountdownApply();
446 }, 1000 );
447 } else {
448 if (typeof elementorFrontend !== 'undefined') {
449 window.waitForRTSB((RTSB) => {
450 RTSB.modules.get('countdownPro')?.refresh();
451 RTSB.modules.get('elementorInitPro')?.refresh();
452 RTSB.modules.get('ajaxProductFiltersPro')?.refresh();
453 });
454 }
455 }
456 <?php } ?>
457 </script>
458
459 <?php
460 }
461
462 /**
463 * Starts an Elementor Section
464 *
465 * @param string $label Section label.
466 * @param object $tab Tab ID.
467 * @param array $conditions Section Condition.
468 * @param array $condition Section Conditions.
469 * @return array
470 */
471 public function start_section( $label, $tab, $conditions = [], $condition = [] ) {
472 $start = [
473 'mode' => 'section_start',
474 'tab' => $tab,
475 'label' => $label,
476 ];
477 if ( ! empty( $condition ) ) {
478 $start['condition'] = $condition;
479 }
480 if ( ! empty( $conditions ) ) {
481 $start['conditions'] = $conditions;
482 }
483 return $start;
484 }
485
486 /**
487 * Ends an Elementor Section
488 *
489 * @return array
490 */
491 public function end_section() {
492 return [
493 'mode' => 'section_end',
494 ];
495 }
496
497 /**
498 * Theme Support for render/widget_controls
499 *
500 * @param string $support Support for render/widget_controls.
501 * @return void
502 */
503 public function theme_support( $support = 'render' ) {
504
505 if ( empty( $support ) ) {
506 return;
507 }
508 $theme = ucwords( str_replace( [ '_', '-', ' ' ], '', rtsb()->current_theme ) );
509
510 $supportClass = apply_filters(
511 'radiustheme/sb/widgetsupport/class',
512 [
513 'ShopbuilderPlugin' => 'RadiusTheme\SB\Controllers\ThemesSupport\\' . $theme . '\\WidgetsSupport',
514 'TheTheme' => \WidgetSupport::class,
515 ]
516 );
517
518 foreach ( $supportClass as $key => $theClass ) {
519 $themeWidgetSupport = get_theme_file_path( '/shopbuilder/WidgetSupport.php' );
520 if ( 'TheTheme' === $key && file_exists( $themeWidgetSupport ) ) {
521 require_once $themeWidgetSupport;
522 }
523 if ( class_exists( $theClass ) ) {
524 $method = $support . '_' . str_replace( [ '-', ' ' ], '_', $this->rtsb_base );
525 if ( method_exists( $theClass, $method ) ) {
526 $theClass::instance( $this )->$method();
527 }
528 }
529 }
530 }
531
532 /**
533 * Starts an Elementor tab group.
534 *
535 * @param array $conditions Tab condition.
536 * @param array $condition Tab condition.
537 * @return array
538 */
539 public function start_tab_group( $conditions = [], $condition = [] ) {
540 return [
541 'mode' => 'tabs_start',
542 'conditions' => $conditions,
543 'condition' => $condition,
544 ];
545 }
546
547 /**
548 * Ends an Elementor tab group.
549 *
550 * @param array $conditions Tab condition.
551 * @param array $condition Tab condition.
552 * @return array
553 */
554 public function end_tab_group( $conditions = [], $condition = [] ) {
555 return [
556 'mode' => 'tabs_end',
557 'conditions' => $conditions,
558 'condition' => $condition,
559 ];
560 }
561
562 /**
563 * Starts an Elementor tab
564 *
565 * @param string $label Section label.
566 * @param array $conditions Tab condition.
567 * @param array $condition Tab condition.
568 * @return array
569 */
570 public function start_tab( $label, $conditions = [], $condition = [] ) {
571 return [
572 'mode' => 'tab_start',
573 'label' => $label,
574 'conditions' => $conditions,
575 'condition' => $condition,
576 ];
577 }
578
579 /**
580 * Ends an Elementor tab.
581 *
582 * @param array $conditions Tab condition.
583 * @param array $condition Tab condition.
584 * @return array
585 */
586 public function end_tab( $conditions = [], $condition = [] ) {
587 return [
588 'mode' => 'tab_end',
589 'conditions' => $conditions,
590 'condition' => $condition,
591 ];
592 }
593
594 /**
595 * Starts an Elementor Section Heading
596 *
597 * @param string $label Heading label.
598 * @param string $separator Section separator.
599 * @param array $conditions Section Condition.
600 * @param array $condition Section Conditions.
601 * @return array
602 */
603 public function el_heading( $label, $separator = null, $conditions = [], $condition = [] ) {
604 return [
605 'type' => 'html',
606 'raw' => sprintf(
607 '<h3 class="rtsb-elementor-group-heading">%s</h3>',
608 $label
609 ),
610 'separator' => $separator,
611 'content_classes' => 'elementor-panel-heading-title',
612 'conditions' => $conditions,
613 'condition' => $condition,
614 ];
615 }
616
617 /**
618 * Prints a control notification.
619 *
620 * @param string $label Field label.
621 * @return string
622 */
623 public function is_pro_control( $label ) {
624 if ( rtsb()->has_pro() ) {
625 return $label;
626 }
627
628 return $label . $this->pro_label;
629 }
630
631 /**
632 * Adds a class.
633 *
634 * @return string
635 */
636 public function pro_class() {
637 return ! rtsb()->has_pro() ? 'rtsb-pro-field' : '';
638 }
639
640 /**
641 * Elementor Fields.
642 *
643 * @param string $type Control type.
644 *
645 * @return string
646 */
647 private static function el_fields( $type ) {
648
649 $controls = Controls_Manager::class;
650
651 switch ( $type ) {
652 case 'link':
653 $type = $controls::URL;
654 break;
655
656 case 'image-dimensions':
657 $type = $controls::IMAGE_DIMENSIONS;
658 break;
659
660 case 'html':
661 $type = $controls::RAW_HTML;
662 break;
663
664 case 'switch':
665 $type = $controls::SWITCHER;
666 break;
667
668 case 'popover':
669 $type = $controls::POPOVER_TOGGLE;
670 break;
671
672 case 'rtsb-image-selector':
673 $type = \RadiusTheme\SB\Elementor\Controls\ImageSelectorControl::$controlName;
674 break;
675
676 case 'rt-select2':
677 $type = \RadiusTheme\SB\Elementor\Controls\Select2AjaxControl::$controlName;
678 break;
679
680 case 'typography':
681 $type = Group_Control_Typography::get_type();
682 break;
683
684 case 'border':
685 $type = Group_Control_Border::get_type();
686 break;
687
688 case 'background':
689 $type = Group_Control_Background::get_type();
690 break;
691
692 case 'box-shadow':
693 $type = Group_Control_Box_Shadow::get_type();
694 break;
695
696 case 'text-shadow':
697 $type = Group_Control_Text_Shadow::get_type();
698 break;
699
700 case 'text-stroke':
701 $type = Group_Control_Text_Stroke::get_type();
702 break;
703
704 case 'css-filter':
705 $type = Group_Control_Css_Filter::get_type();
706 break;
707 default:
708 $type = constant( 'Elementor\Controls_Manager::' . strtoupper( $type ) );
709
710 }
711 return $type;
712 }
713
714 /**
715 * Elementor Fields.
716 *
717 * @param string $tab Tab.
718 *
719 * @return string
720 */
721 private static function el_tabs( $tab ) {
722 return constant( 'Elementor\Controls_Manager::TAB_' . strtoupper( $tab ) );
723 }
724
725
726 /**
727 * Init render hooks & functions.
728 *
729 * @return void
730 */
731 protected function render_start() {
732 add_filter( 'rtsb/countdown/campaign/parent/class', [ $this, 'countdown_campaign_parent_class' ], 15 );
733 do_action( 'rtsb/custom/products/before/template/load', $this );
734 $this->theme_support();
735
736 if ( $this->is_builder_mode() ) {
737 add_filter( 'wp_kses_allowed_html', [ FilterHooks::class, 'custom_wpkses_post_tags' ], 10, 2 );
738 }
739 }
740 /**
741 * Archive Custom Layout Widget Rendering.
742 *
743 * @param array $classes class list.
744 *
745 * @return array
746 */
747 public function countdown_campaign_parent_class( $classes ) {
748 $settings = $this->get_settings_for_display();
749 $layout = $settings['countdown_layout'] ?? 'horizontal';
750 $v_position = $settings['countdown_vertical_position'] ?? '';
751 $countdown_preset = $settings['countdown_preset'] ?? '';
752 $vertical_center = $settings['countdown_vertical_center'] ?? false;
753
754 $remove = [
755 'rtsb-countdown-horizontal',
756 'rtsb-countdown-vertical',
757 'rtsb-vertical-position-top-left',
758 'rtsb-vertical-position-top-right',
759 ];
760 $classes = array_filter(
761 $classes,
762 function ( $item ) use ( $remove ) {
763 return ! in_array( $item, $remove ); // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
764 }
765 );
766 $new_class = 'rtsb-countdown-' . esc_attr( $countdown_preset );
767 $new_class .= ' rtsb-countdown-' . esc_attr( $layout );
768
769 if ( $v_position && 'horizontal' !== $layout ) {
770 $vertical_class = 'rtsb-vertical-position-top-' . esc_attr( $v_position );
771 $classes[] = $vertical_class;
772 if ( 'yes' === $vertical_center ) {
773 $classes[] = 'rtsb-countdown-vertical-middle';
774 }
775 }
776
777 $classes[] = $new_class;
778
779 return $classes;
780 }
781 /**
782 * End render hooks & functions.
783 *
784 * @return void
785 */
786 protected function render_end() {
787 $this->edit_mode_script();
788 do_action( 'rtsb/custom/products/after/template/load', $this );
789 $this->theme_support( 'render_reset' );
790 remove_filter( 'rtsb/countdown/campaign/parent/class', [ $this, 'countdown_campaign_parent_class' ], 15 );
791 }
792
793 /**
794 * Elementor controls marge all settings
795 *
796 * @return void
797 */
798 protected function apply_hooks_before_render() {
799 if ( $this->is_edit_mode() ) {
800 add_filter( 'wp_calculate_image_srcset_meta', '__return_null' );
801 }
802 }
803
804 /**
805 * If checkout registration is disabled and not logged in,
806 * the user cannot check out.
807 *
808 * @return bool
809 */
810 protected function has_checkout_restriction() {
811 $checkout = WC()->checkout();
812
813 return ! $checkout->is_registration_enabled() && $checkout->is_registration_required() && ! is_user_logged_in();
814 }
815
816 /**
817 * Widget Exceptions.
818 *
819 * @return bool
820 */
821 private function widget_exceptions() {
822 $exceptions = [
823 'rtsb-product-filters',
824 'rtsb-wishlist',
825 'rtsb-product-breadcrumbs',
826 ];
827
828 return in_array( $this->rtsb_base, $exceptions, true );
829 }
830 }
831