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 / SocialShare.php

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

139 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * SocialShare class.
4 *
5 * @package RadiusTheme\SB
6 */
7
8 namespace RadiusTheme\SB\Elementor\Widgets\General;
9
10 use RadiusTheme\SB\Helpers\BuilderFns;
11 use RadiusTheme\SB\Helpers\Fns;
12 use RadiusTheme\SB\Elementor\Render\Render;
13 use RadiusTheme\SB\Elementor\Widgets\Controls;
14 use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
15
16 // Do not allow directly accessing this file.
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit( 'This script cannot be accessed directly.' );
19 }
20
21 /**
22 * SocialShare class.
23 */
24 class SocialShare extends ElementorWidgetBase {
25 /**
26 * Control Fields
27 *
28 * @var array
29 */
30 private $control_fields = [];
31
32 /**
33 * Construct function
34 *
35 * @param array $data default array.
36 * @param mixed $args default arg.
37 */
38 public function __construct( $data = [], $args = null ) {
39 $this->rtsb_name = esc_html__( 'Social Share', 'shopbuilder' );
40 $this->rtsb_base = 'rtsb-social-share';
41
42 parent::__construct( $data, $args );
43
44 $this->pro_tab = 'content';
45
46 $type = BuilderFns::builder_type( get_the_ID() );
47 if ( 'quick-view' !== $type ) {
48 $this->rtsb_category = 'rtsb-shopbuilder-general';
49 }
50 }
51
52 /**
53 * Style dependencies.
54 *
55 * @return array
56 */
57 public function get_style_depends(): array {
58 if ( ! $this->is_edit_mode() ) {
59 return [];
60 }
61
62 return [
63 'elementor-icons-shared-0',
64 'elementor-icons-fa-solid',
65 ];
66 }
67
68 /**
69 * Controls for layout tab
70 *
71 * @return SocialShare
72 */
73 protected function layout_tab() {
74 $sections = apply_filters(
75 'rtsb/elements/elementor/share_layout_tab',
76 array_merge(
77 Controls\ContentFields::share_presets( $this ),
78 Controls\ContentFields::share_platforms( $this ),
79 ),
80 $this
81 );
82
83 $this->control_fields = array_merge( $this->control_fields, $sections );
84
85 return $this;
86 }
87
88 /**
89 * Controls for style tab
90 *
91 * @return SocialShare
92 */
93 protected function style_tab() {
94 $sections = apply_filters(
95 'rtsb/elements/elementor/share_style_tab',
96 array_merge(
97 Controls\StyleFields::share_items( $this ),
98 Controls\StyleFields::share_header( $this ),
99 Controls\StyleFields::share_icons( $this ),
100 Controls\StyleFields::share_text( $this ),
101 ),
102 $this
103 );
104
105 $this->control_fields = array_merge( $this->control_fields, $sections );
106
107 return $this;
108 }
109
110 /**
111 * Widget Field
112 *
113 * @return array
114 */
115 public function widget_fields() {
116 $this->layout_tab()->style_tab();
117
118 if ( empty( $this->control_fields ) ) {
119 return [];
120 }
121
122 return $this->control_fields;
123 }
124
125 /**
126 * Render Function
127 *
128 * @return void
129 */
130 protected function render() {
131 $settings = $this->get_settings_for_display();
132 $this->theme_support();
133 $template = 'elementor/general/social-share';
134
135 Fns::print_html( Render::instance()->social_share_view( $template, $settings ), true );
136 $this->theme_support( 'render_reset' );
137 }
138 }
139