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

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

132 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\Fns;
11 use RadiusTheme\SB\Elementor\Render\Render;
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 );
76
77 $this->control_fields = array_merge( $this->control_fields, $sections );
78
79 return $this;
80 }
81
82 /**
83 * Controls for style tab
84 *
85 * @return SocialShare
86 */
87 protected function style_tab() {
88 $sections = apply_filters(
89 'rtsb/elements/elementor/share_style_tab',
90 array_merge(
91 Controls\StyleFields::share_items( $this ),
92 Controls\StyleFields::share_icons( $this ),
93 Controls\StyleFields::share_text( $this ),
94 )
95 );
96
97 $this->control_fields = array_merge( $this->control_fields, $sections );
98
99 return $this;
100 }
101
102 /**
103 * Widget Field
104 *
105 * @return void|array
106 */
107 public function widget_fields() {
108 $this->layout_tab()->style_tab();
109
110 if ( empty( $this->control_fields ) ) {
111 return [];
112 }
113
114 return apply_filters( 'rtsb/elements/elementor/general/' . $this->rtsb_base, $this->control_fields, $this );
115 }
116
117 /**
118 * Render Function
119 *
120 * @return void
121 */
122 protected function render() {
123 $settings = $this->get_settings_for_display();
124 $this->theme_support();
125 $template = 'elementor/general/social-share';
126
127 Fns::print_html( Render::instance()->social_share_view( $template, $settings ), true );
128 $this->theme_support( 'render_reset' );
129 }
130
131 }
132