PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.1
ShopBuilder – WooCommerce Builder For Elementor v2.1.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 / Elementor / Widgets / General / SocialShare.php

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

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