PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.3
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.3
4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 All 201 releases
← All changes | includes/Editors/Elementor/Widget/DocShare.php +651 -284 3.4.2 → 4.9.3 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2 namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget;
3 3
4 4 if ( ! defined( 'ABSPATH' ) ) {
5 - exit; // Exit if accessed directly
5 + exit; // Exit if accessed directly
6 6 }
7 7
8 8 use Elementor\Controls_Manager;
9 9 use Elementor\Group_Control_Background;
@@ -8,328 +8,695 @@
8 8 use Elementor\Controls_Manager;
9 9 use Elementor\Group_Control_Background;
10 10 use Elementor\Group_Control_Typography;
11 11 use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget;
12 -use Elementor\Group_Control_Border as Group_Control_Border;
12 +use Elementor\Group_Control_Border;
13 13 use WPDeveloper\BetterDocs\Traits\SocialShare as SocialShareTrait;
14 -use Elementor\Group_Control_Box_Shadow as Group_Control_Box_Shadow;
14 +use Elementor\Group_Control_Box_Shadow;
15 15
16 16 class DocShare extends BaseWidget {
17 - use SocialShareTrait;
17 + use SocialShareTrait;
18 18
19 - protected $map_view_vars = [
20 - 'share_title' => 'title'
21 - ];
19 + protected $map_view_vars = [
20 + 'share_title' => 'title',
21 + 'share_title_tag' => 'title_tag'
22 + ];
22 23
23 - public function get_name() {
24 - return 'betterdocs-doc-share';
25 - }
24 + public function get_name() {
25 + return 'betterdocs-doc-share';
26 + }
26 27
27 - public function get_title() {
28 - return __( 'Doc Share', 'betterdocs' );
29 - }
28 + public function get_title() {
29 + return __( 'Doc Share', 'betterdocs' );
30 + }
30 31
31 - public function get_icon() {
32 - return 'betterdocs-icon-Social-Share';
33 - }
32 + public function get_icon() {
33 + return 'betterdocs-icon-Social-Share';
34 + }
34 35
35 - public function get_categories() {
36 - return ['betterdocs-elements-single'];
37 - }
36 + public function get_categories() {
37 + return [ 'betterdocs-elements-single' ];
38 + }
38 39
39 - public function get_keywords() {
40 - return ['betterdocs-elements', 'share', 'betterdocs', 'heading', 'docs'];
41 - }
40 + public function get_keywords() {
41 + return [ 'betterdocs-elements', 'share', 'betterdocs', 'heading', 'docs' ];
42 + }
42 43
43 - public function get_style_depends() {
44 - return ['betterdocs-social-share'];
45 - }
44 + public function get_style_depends() {
45 + return [ 'betterdocs-social-share' ];
46 + }
46 47
47 - public function get_custom_help_url() {
48 - return 'https://betterdocs.co/docs/single-doc-in-elementor';
49 - }
48 + public function get_custom_help_url() {
49 + return 'https://betterdocs.co/docs/single-doc-in-elementor';
50 + }
50 51
51 - protected function register_controls() {
52 - $this->share_controls();
52 + protected function register_controls() {
53 + $this->share_controls();
53 54
54 - $this->start_controls_section(
55 - 'section_column_settings',
56 - [
57 - 'label' => __( 'Box Style', 'betterdocs' ),
58 - 'tab' => Controls_Manager::TAB_STYLE
59 - ]
60 - );
55 + $this->box_style_layout_1();
56 + $this->box_container_wrapper();
57 + $this->box_style_layout_2();
61 58
62 - $this->add_control(
63 - 'share_box_width',
64 - [
65 - 'label' => __( 'Width', 'betterdocs' ),
66 - 'type' => Controls_Manager::SLIDER,
67 - 'size_units' => ['px', '%', 'em'],
68 - 'range' => [
69 - 'px' => [
70 - 'min' => 0,
71 - 'max' => 2000,
72 - 'step' => 1
73 - ],
74 - '%' => [
75 - 'min' => 0,
76 - 'max' => 100,
77 - 'step' => 1
78 - ],
79 - 'em' => [
80 - 'min' => 100,
81 - 'max' => 100,
82 - 'step' => 1
83 - ]
84 - ],
85 - 'default' => [
86 - 'unit' => '%',
87 - 'size' => 100
88 - ],
89 - 'selectors' => [
90 - '{{WRAPPER}} .betterdocs-social-share' => 'width: {{SIZE}}{{UNIT}};'
91 - ]
92 - ]
93 - );
59 + $this->box_title_layout_1();
60 + $this->box_title_layout_2();
94 61
95 - $this->add_control(
96 - 'share_box_height',
97 - [
98 - 'label' => __( 'Height', 'betterdocs' ),
99 - 'type' => Controls_Manager::SLIDER,
100 - 'size_units' => ['px'],
101 - 'range' => [
102 - 'px' => [
103 - 'max' => 500,
104 - 'step' => 1
105 - ]
106 - ],
107 - 'selectors' => [
108 - '{{WRAPPER}} .betterdocs-social-share' => 'height: {{SIZE}}px;'
109 - ]
110 - ]
111 - );
62 + $this->icon_style();
63 + $this->icon_style_layout_2();
64 + }
112 65
113 - $this->add_group_control(
114 - Group_Control_Background::get_type(),
115 - [
116 - 'name' => 'share_box_background',
117 - 'types' => ['classic', 'gradient'],
118 - 'selector' => '{{WRAPPER}} .betterdocs-social-share'
119 - ]
120 - );
66 + public function box_style_layout_1() {
67 + $this->start_controls_section(
68 + 'section_column_settings',
69 + [
70 + 'label' => __( 'Box Style', 'betterdocs' ),
71 + 'tab' => Controls_Manager::TAB_STYLE,
72 + 'condition' => [
73 + 'share_title_select_layout_layout' => [ 'layout-1' ]
74 + ]
75 + ]
76 + );
121 77
122 - $this->add_responsive_control(
123 - 'share_box_space', // Legacy control id but new control
124 - [
125 - 'label' => __( 'Box Spacing', 'betterdocs' ),
126 - 'type' => Controls_Manager::DIMENSIONS,
127 - 'size_units' => ['px', '%', 'em'],
128 - 'selectors' => [
129 - '{{WRAPPER}} .betterdocs-social-share' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
130 - ]
131 - ]
132 - );
78 + $this->add_control(
79 + 'share_box_width',
80 + [
81 + 'label' => __( 'Width', 'betterdocs' ),
82 + 'type' => Controls_Manager::SLIDER,
83 + 'size_units' => [ 'px', '%', 'em' ],
84 + 'range' => [
85 + 'px' => [
86 + 'min' => 0,
87 + 'max' => 2000,
88 + 'step' => 1
89 + ],
90 + '%' => [
91 + 'min' => 0,
92 + 'max' => 100,
93 + 'step' => 1
94 + ],
95 + 'em' => [
96 + 'min' => 100,
97 + 'max' => 100,
98 + 'step' => 1
99 + ]
100 + ],
101 + 'default' => [
102 + 'unit' => '%',
103 + 'size' => 100
104 + ],
105 + 'selectors' => [
106 + '{{WRAPPER}} .betterdocs-social-share' => 'width: {{SIZE}}{{UNIT}};'
107 + ]
108 + ]
109 + );
133 110
134 - $this->add_responsive_control(
135 - 'share_box_padding',
136 - [
137 - 'label' => __( 'Box Padding', 'betterdocs' ),
138 - 'type' => Controls_Manager::DIMENSIONS,
139 - 'size_units' => ['px', 'em', '%'],
140 - 'selectors' => [
141 - '{{WRAPPER}} .betterdocs-social-share' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
142 - ]
143 - ]
144 - );
111 + $this->add_control(
112 + 'share_box_height',
113 + [
114 + 'label' => __( 'Height', 'betterdocs' ),
115 + 'type' => Controls_Manager::SLIDER,
116 + 'size_units' => [ 'px' ],
117 + 'range' => [
118 + 'px' => [
119 + 'max' => 500,
120 + 'step' => 1
121 + ]
122 + ],
123 + 'selectors' => [
124 + '{{WRAPPER}} .betterdocs-social-share' => 'height: {{SIZE}}px;'
125 + ]
126 + ]
127 + );
145 128
146 - $this->add_group_control(
147 - Group_Control_Border::get_type(),
148 - [
149 - 'name' => 'share_box_border_normal',
150 - 'label' => esc_html__( 'Border', 'betterdocs' ),
151 - 'selector' => '{{WRAPPER}} .betterdocs-social-share'
152 - ]
153 - );
129 + $this->add_group_control(
130 + Group_Control_Background::get_type(),
131 + [
132 + 'name' => 'share_box_background',
133 + 'types' => [ 'classic', 'gradient' ],
134 + 'selector' => '{{WRAPPER}} .betterdocs-social-share'
135 + ]
136 + );
154 137
155 - $this->add_responsive_control(
156 - 'share_box_radius_normal',
157 - [
158 - 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
159 - 'type' => Controls_Manager::DIMENSIONS,
160 - 'size_units' => ['px', 'em', '%'],
161 - 'selectors' => [
162 - '{{WRAPPER}} .betterdocs-social-share' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
163 - ]
164 - ]
165 - );
138 + $this->add_responsive_control(
139 + 'share_box_space', // Legacy control id but new control
140 + [
141 + 'label' => __( 'Box Spacing', 'betterdocs' ),
142 + 'type' => Controls_Manager::DIMENSIONS,
143 + 'size_units' => [ 'px', '%', 'em' ],
144 + 'selectors' => [
145 + '{{WRAPPER}} .betterdocs-social-share' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
146 + ]
147 + ]
148 + );
166 149
167 - $this->add_group_control(
168 - Group_Control_Box_Shadow::get_type(),
169 - [
170 - 'name' => 'share_box_shadow_normal',
171 - 'selector' => '{{WRAPPER}} .betterdocs-social-share'
172 - ]
173 - );
150 + $this->add_responsive_control(
151 + 'share_box_padding',
152 + [
153 + 'label' => __( 'Box Padding', 'betterdocs' ),
154 + 'type' => Controls_Manager::DIMENSIONS,
155 + 'size_units' => [ 'px', 'em', '%' ],
156 + 'selectors' => [
157 + '{{WRAPPER}} .betterdocs-social-share' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
158 + ]
159 + ]
160 + );
174 161
175 - $this->end_controls_section();
162 + $this->add_group_control(
163 + Group_Control_Border::get_type(),
164 + [
165 + 'name' => 'share_box_border_normal',
166 + 'label' => esc_html__( 'Border', 'betterdocs' ),
167 + 'selector' => '{{WRAPPER}} .betterdocs-social-share'
168 + ]
169 + );
176 170
177 - $this->start_controls_section(
178 - 'section_title_settings',
179 - [
180 - 'label' => __( 'Title', 'betterdocs' ),
181 - 'tab' => Controls_Manager::TAB_STYLE
182 - ]
183 - );
171 + $this->add_responsive_control(
172 + 'share_box_radius_normal',
173 + [
174 + 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
175 + 'type' => Controls_Manager::DIMENSIONS,
176 + 'size_units' => [ 'px', 'em', '%' ],
177 + 'selectors' => [
178 + '{{WRAPPER}} .betterdocs-social-share' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
179 + ]
180 + ]
181 + );
184 182
185 - $this->add_control(
186 - 'share_box_title_color',
187 - [
188 - 'label' => esc_html__( 'Color', 'betterdocs' ),
189 - 'type' => Controls_Manager::COLOR,
190 - 'selectors' => [
191 - '{{WRAPPER}} .betterdocs-social-share-heading h5' => 'color: {{VALUE}};'
192 - ]
193 - ]
194 - );
183 + $this->add_group_control(
184 + Group_Control_Box_Shadow::get_type(),
185 + [
186 + 'name' => 'share_box_shadow_normal',
187 + 'selector' => '{{WRAPPER}} .betterdocs-social-share'
188 + ]
189 + );
195 190
196 - $this->add_group_control(
197 - Group_Control_Typography::get_type(),
198 - [
199 - 'name' => 'share_box_title_typography',
200 - 'selector' => '{{WRAPPER}} .betterdocs-social-share-heading h5'
201 - ]
202 - );
191 + $this->end_controls_section();
192 + }
203 193
204 - $this->end_controls_section();
194 + public function box_container_wrapper() {
195 + $this->start_controls_section(
196 + 'section_box_container_layout_2',
197 + [
198 + 'label' => __( 'Wrapper Container', 'betterdocs' ),
199 + 'tab' => Controls_Manager::TAB_STYLE,
200 + 'condition' => [
201 + 'share_title_select_layout_layout' => [ 'layout-2' ]
202 + ]
203 + ]
204 + );
205 205
206 - $this->icon_style();
207 - }
206 + $this->add_responsive_control(
207 + 'section_box_container_layout_2_padding',
208 + [
209 + 'label' => __( 'Box Padding', 'betterdocs' ),
210 + 'type' => Controls_Manager::DIMENSIONS,
211 + 'size_units' => [ 'px', 'em', '%' ],
212 + 'selectors' => [
213 + '{{WRAPPER}} .betterdocs-social-share.layout-2' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
214 + ]
215 + ]
216 + );
208 217
209 - public function share_controls() {
210 - $this->start_controls_section(
211 - 'section_options',
212 - [
213 - 'label' => __( 'Controls', 'betterdocs' )
214 - ]
215 - );
218 + $this->add_responsive_control(
219 + 'section_box_container_layout_2_margin',
220 + [
221 + 'label' => __( 'Box Margin', 'betterdocs' ),
222 + 'type' => Controls_Manager::DIMENSIONS,
223 + 'size_units' => [ 'px', 'em', '%' ],
224 + 'selectors' => [
225 + '{{WRAPPER}} .betterdocs-social-share.layout-2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
226 + ]
227 + ]
228 + );
216 229
217 - $this->add_control(
218 - 'share_title',
219 - [
220 - 'label' => __( 'Title', 'betterdocs' ),
221 - 'type' => Controls_Manager::TEXT,
222 - 'default' => __( 'Share This Article :', 'betterdocs' ),
223 - 'placeholder' => __( 'Type share title here', 'betterdocs' )
224 - ]
225 - );
230 + $this->add_group_control(
231 + Group_Control_Background::get_type(),
232 + [
233 + 'name' => 'section_box_container_layout_2_background_color',
234 + 'types' => [ 'classic', 'gradient' ],
235 + 'selector' => '{{WRAPPER}} .betterdocs-social-share.layout-2'
236 + ]
237 + );
226 238
227 - $this->add_control(
228 - 'facebook',
229 - [
230 - 'label' => __( 'Facebook', 'betterdocs' ),
231 - 'type' => Controls_Manager::SWITCHER,
232 - 'label_on' => __( 'Show', 'betterdocs' ),
233 - 'label_off' => __( 'Hide', 'betterdocs' ),
234 - 'return_value' => '1',
235 - 'default' => '1'
236 - ]
237 - );
239 + $this->end_controls_section();
240 + }
238 241
239 - $this->add_control(
240 - 'twitter',
241 - [
242 - 'label' => __( 'Twitter', 'betterdocs' ),
243 - 'type' => Controls_Manager::SWITCHER,
244 - 'label_on' => __( 'Show', 'betterdocs' ),
245 - 'label_off' => __( 'Hide', 'betterdocs' ),
246 - 'return_value' => '1',
247 - 'default' => '1'
248 - ]
249 - );
242 + public function box_style_layout_2() {
243 + $this->start_controls_section(
244 + 'section_column_settings_layout_2',
245 + [
246 + 'label' => __( 'Box Style', 'betterdocs' ),
247 + 'tab' => Controls_Manager::TAB_STYLE,
248 + 'condition' => [
249 + 'share_title_select_layout_layout' => [ 'layout-2' ]
250 + ]
251 + ]
252 + );
250 253
251 - $this->add_control(
252 - 'linkedin',
253 - [
254 - 'label' => __( 'Linkedin', 'betterdocs' ),
255 - 'type' => Controls_Manager::SWITCHER,
256 - 'label_on' => __( 'Show', 'betterdocs' ),
257 - 'label_off' => __( 'Hide', 'betterdocs' ),
258 - 'return_value' => '1',
259 - 'default' => '1'
260 - ]
261 - );
254 + $this->add_control(
255 + 'share_box_width_layout_2',
256 + [
257 + 'label' => __( 'Width', 'betterdocs' ),
258 + 'type' => Controls_Manager::SLIDER,
259 + 'size_units' => [ 'px', '%', 'em' ],
260 + 'range' => [
261 + 'px' => [
262 + 'min' => 0,
263 + 'max' => 2000,
264 + 'step' => 1
265 + ],
266 + '%' => [
267 + 'min' => 0,
268 + 'max' => 100,
269 + 'step' => 1
270 + ],
271 + 'em' => [
272 + 'min' => 100,
273 + 'max' => 100,
274 + 'step' => 1
275 + ]
276 + ],
277 + 'default' => [
278 + 'unit' => '%',
279 + 'size' => 100
280 + ],
281 + 'selectors' => [
282 + '{{WRAPPER}} .betterdocs-social-share.layout-2' => 'width: {{SIZE}}{{UNIT}};'
283 + ]
284 + ]
285 + );
262 286
263 - $this->add_control(
264 - 'pinterest',
265 - [
266 - 'label' => __( 'Pinterest', 'betterdocs' ),
267 - 'type' => Controls_Manager::SWITCHER,
268 - 'label_on' => __( 'Show', 'betterdocs' ),
269 - 'label_off' => __( 'Hide', 'betterdocs' ),
270 - 'return_value' => '1',
271 - 'default' => '1'
272 - ]
273 - );
287 + $this->add_control(
288 + 'share_box_height_layout_2',
289 + [
290 + 'label' => __( 'Height', 'betterdocs' ),
291 + 'type' => Controls_Manager::SLIDER,
292 + 'size_units' => [ 'px' ],
293 + 'range' => [
294 + 'px' => [
295 + 'max' => 500,
296 + 'step' => 1
297 + ]
298 + ],
299 + 'selectors' => [
300 + '{{WRAPPER}} .betterdocs-social-share.layout-2' => 'height: {{SIZE}}px;'
301 + ]
302 + ]
303 + );
274 304
275 - $this->end_controls_section();
276 - }
305 + $this->add_group_control(
306 + Group_Control_Background::get_type(),
307 + [
308 + 'name' => 'share_box_background_layout_2',
309 + 'types' => [ 'classic', 'gradient' ],
310 + 'selector' => '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2'
311 + ]
312 + );
277 313
278 - public function icon_style() {
279 - $this->start_controls_section(
280 - 'section_icon_settings',
281 - [
282 - 'label' => __( 'Icon', 'betterdocs' ),
283 - 'tab' => Controls_Manager::TAB_STYLE
284 - ]
285 - );
314 + $this->add_responsive_control(
315 + 'share_box_space_layout_2', // Legacy control id but new control
316 + [
317 + 'label' => __( 'Box Spacing', 'betterdocs' ),
318 + 'type' => Controls_Manager::DIMENSIONS,
319 + 'size_units' => [ 'px', '%', 'em' ],
320 + 'selectors' => [
321 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
322 + ]
323 + ]
324 + );
286 325
287 - $this->add_responsive_control(
288 - 'share_icon_space', // Legacy control id but new control
289 - [
290 - 'label' => __( 'Spacing', 'betterdocs' ),
291 - 'type' => Controls_Manager::DIMENSIONS,
292 - 'size_units' => ['px', '%', 'em'],
293 - 'selectors' => [
294 - '{{WRAPPER}} .betterdocs-social-share-links li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
295 - ]
296 - ]
297 - );
326 + $this->add_responsive_control(
327 + 'share_box_padding_layout_2',
328 + [
329 + 'label' => __( 'Box Padding', 'betterdocs' ),
330 + 'type' => Controls_Manager::DIMENSIONS,
331 + 'size_units' => [ 'px', 'em', '%' ],
332 + 'selectors' => [
333 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
334 + ]
335 + ]
336 + );
298 337
299 - $this->add_responsive_control(
300 - 'share_icon_padding',
301 - [
302 - 'label' => __( 'Padding', 'betterdocs' ),
303 - 'type' => Controls_Manager::DIMENSIONS,
304 - 'size_units' => ['px', 'em', '%'],
305 - 'selectors' => [
306 - '{{WRAPPER}} .betterdocs-social-share-links li' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
307 - ]
308 - ]
309 - );
338 + $this->add_group_control(
339 + Group_Control_Border::get_type(),
340 + [
341 + 'name' => 'share_box_border_normal_layout_2',
342 + 'label' => esc_html__( 'Border', 'betterdocs' ),
343 + 'selector' => '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2'
344 + ]
345 + );
310 346
311 - $this->add_control(
312 - 'share_share_icon_area',
313 - [
314 - 'label' => __( 'Size', 'betterdocs' ),
315 - 'type' => Controls_Manager::SLIDER,
316 - 'size_units' => ['px'],
317 - 'range' => [
318 - 'px' => [
319 - 'max' => 500,
320 - 'step' => 1
321 - ]
322 - ],
323 - 'selectors' => [
324 - '{{WRAPPER}} .betterdocs-social-share-links li a img' => 'height: {{SIZE}}px;width: {{SIZE}}px;'
325 - ]
326 - ]
327 - );
347 + $this->add_responsive_control(
348 + 'share_box_radius_normal_layout_2',
349 + [
350 + 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
351 + 'type' => Controls_Manager::DIMENSIONS,
352 + 'size_units' => [ 'px', 'em', '%' ],
353 + 'selectors' => [
354 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
355 + ]
356 + ]
357 + );
328 358
329 - $this->end_controls_section();
330 - }
359 + $this->add_group_control(
360 + Group_Control_Box_Shadow::get_type(),
361 + [
362 + 'name' => 'share_box_shadow_normal_layout_2',
363 + 'selector' => '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2'
364 + ]
365 + );
331 366
332 - protected function render_callback() {
333 - $this->views( 'widgets/social' );
334 - }
367 + $this->end_controls_section();
368 + }
369 +
370 + public function box_title_layout_1() {
371 + $this->start_controls_section(
372 + 'section_title_settings',
373 + [
374 + 'label' => __( 'Title', 'betterdocs' ),
375 + 'tab' => Controls_Manager::TAB_STYLE,
376 + 'condition' => [
377 + 'share_title_select_layout_layout' => [ 'layout-1' ]
378 + ]
379 + ]
380 + );
381 +
382 + $this->add_control(
383 + 'share_box_title_color',
384 + [
385 + 'label' => esc_html__( 'Color', 'betterdocs' ),
386 + 'type' => Controls_Manager::COLOR,
387 + 'selectors' => [
388 + '{{WRAPPER}} .betterdocs-social-share-heading .betterdocs-social-share-title-tag' => 'color: {{VALUE}};'
389 + ]
390 + ]
391 + );
392 +
393 + $this->add_group_control(
394 + Group_Control_Typography::get_type(),
395 + [
396 + 'name' => 'share_box_title_typography',
397 + 'selector' => '{{WRAPPER}} .betterdocs-social-share-heading .betterdocs-social-share-title-tag'
398 + ]
399 + );
400 +
401 + $this->end_controls_section();
402 + }
403 +
404 + public function box_title_layout_2() {
405 + $this->start_controls_section(
406 + 'section_title_settings_layout_2',
407 + [
408 + 'label' => __( 'Title', 'betterdocs' ),
409 + 'tab' => Controls_Manager::TAB_STYLE,
410 + 'condition' => [
411 + 'share_title_select_layout_layout' => [ 'layout-2' ]
412 + ]
413 + ]
414 + );
415 +
416 + $this->add_control(
417 + 'share_box_title_color_layout_2',
418 + [
419 + 'label' => esc_html__( 'Color', 'betterdocs' ),
420 + 'type' => Controls_Manager::COLOR,
421 + 'selectors' => [
422 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-heading.layout-2 h5' => 'color: {{VALUE}};'
423 + ]
424 + ]
425 + );
426 +
427 + $this->add_group_control(
428 + Group_Control_Typography::get_type(),
429 + [
430 + 'name' => 'share_box_title_typography_layout_2',
431 + 'selector' => '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-heading.layout-2 h5'
432 + ]
433 + );
434 +
435 + $this->add_responsive_control(
436 + 'section_title_layout_2_padding',
437 + [
438 + 'label' => __( 'Box Padding', 'betterdocs' ),
439 + 'type' => Controls_Manager::DIMENSIONS,
440 + 'size_units' => [ 'px', 'em', '%' ],
441 + 'selectors' => [
442 + '{{WRAPPER}} betterdocs-social-share.layout-2 .betterdocs-social-share-heading.layout-2 h5' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
443 + ]
444 + ]
445 + );
446 +
447 + $this->add_responsive_control(
448 + 'section_title_layout_2_margin',
449 + [
450 + 'label' => __( 'Box Margin', 'betterdocs' ),
451 + 'type' => Controls_Manager::DIMENSIONS,
452 + 'size_units' => [ 'px', 'em', '%' ],
453 + 'selectors' => [
454 + '{{WRAPPER}} betterdocs-social-share.layout-2 .betterdocs-social-share-heading.layout-2 h5' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
455 + ]
456 + ]
457 + );
458 +
459 + $this->end_controls_section();
460 + }
461 +
462 + public function share_controls() {
463 + $this->start_controls_section(
464 + 'section_options',
465 + [
466 + 'label' => __( 'Controls', 'betterdocs' )
467 + ]
468 + );
469 +
470 + $this->add_control(
471 + 'share_title_select_layout_layout',
472 + [
473 + 'label' => esc_html__( 'Select layout', 'betterdocs' ),
474 + 'type' => Controls_Manager::SELECT,
475 + 'default' => 'layout-1',
476 + 'label_block' => false,
477 + 'options' => [
478 + 'layout-1' => esc_html__( 'Layout 1', 'betterdocs' ),
479 + 'layout-2' => esc_html__( 'Layout 2', 'betterdocs' )
480 + ]
481 + ]
482 + );
483 +
484 + $this->add_control(
485 + 'share_title',
486 + [
487 + 'label' => __( 'Title', 'betterdocs' ),
488 + 'type' => Controls_Manager::TEXT,
489 + 'default' => __( 'Share This Article :', 'betterdocs' ),
490 + 'placeholder' => __( 'Type share title here', 'betterdocs' )
491 + ]
492 + );
493 +
494 + $this->add_control(
495 + 'share_title_tag',
496 + [
497 + 'label' => __( 'Title Tag', 'betterdocs' ),
498 + 'type' => Controls_Manager::SELECT,
499 + 'default' => 'h5',
500 + 'options' => [
501 + 'h1' => 'H1',
502 + 'h2' => 'H2',
503 + 'h3' => 'H3',
504 + 'h4' => 'H4',
505 + 'h5' => 'H5',
506 + 'h6' => 'H6',
507 + ],
508 + ]
509 + );
510 +
511 + $this->add_control(
512 + 'facebook',
513 + [
514 + 'label' => __( 'Facebook', 'betterdocs' ),
515 + 'type' => Controls_Manager::SWITCHER,
516 + 'label_on' => __( 'Show', 'betterdocs' ),
517 + 'label_off' => __( 'Hide', 'betterdocs' ),
518 + 'return_value' => '1',
519 + 'default' => '1'
520 + ]
521 + );
522 +
523 + $this->add_control(
524 + 'twitter',
525 + [
526 + 'label' => __( 'Twitter', 'betterdocs' ),
527 + 'type' => Controls_Manager::SWITCHER,
528 + 'label_on' => __( 'Show', 'betterdocs' ),
529 + 'label_off' => __( 'Hide', 'betterdocs' ),
530 + 'return_value' => '1',
531 + 'default' => '1'
532 + ]
533 + );
534 +
535 + $this->add_control(
536 + 'linkedin',
537 + [
538 + 'label' => __( 'Linkedin', 'betterdocs' ),
539 + 'type' => Controls_Manager::SWITCHER,
540 + 'label_on' => __( 'Show', 'betterdocs' ),
541 + 'label_off' => __( 'Hide', 'betterdocs' ),
542 + 'return_value' => '1',
543 + 'default' => '1'
544 + ]
545 + );
546 +
547 + $this->add_control(
548 + 'pinterest',
549 + [
550 + 'label' => __( 'Pinterest', 'betterdocs' ),
551 + 'type' => Controls_Manager::SWITCHER,
552 + 'label_on' => __( 'Show', 'betterdocs' ),
553 + 'label_off' => __( 'Hide', 'betterdocs' ),
554 + 'return_value' => '1',
555 + 'default' => '1'
556 + ]
557 + );
558 +
559 + $this->end_controls_section();
560 + }
561 +
562 + public function icon_style() {
563 + $this->start_controls_section(
564 + 'section_icon_settings',
565 + [
566 + 'label' => __( 'Icon', 'betterdocs' ),
567 + 'tab' => Controls_Manager::TAB_STYLE,
568 + 'condition' => [
569 + 'share_title_select_layout_layout' => [ 'layout-1' ]
570 + ]
571 + ]
572 + );
573 +
574 + $this->add_responsive_control(
575 + 'share_icon_space', // Legacy control id but new control
576 + [
577 + 'label' => __( 'Spacing', 'betterdocs' ),
578 + 'type' => Controls_Manager::DIMENSIONS,
579 + 'size_units' => [ 'px', '%', 'em' ],
580 + 'selectors' => [
581 + '{{WRAPPER}} .betterdocs-social-share-links li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
582 + ]
583 + ]
584 + );
585 +
586 + $this->add_responsive_control(
587 + 'share_icon_padding',
588 + [
589 + 'label' => __( 'Padding', 'betterdocs' ),
590 + 'type' => Controls_Manager::DIMENSIONS,
591 + 'size_units' => [ 'px', 'em', '%' ],
592 + 'selectors' => [
593 + '{{WRAPPER}} .betterdocs-social-share-links li' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
594 + ]
595 + ]
596 + );
597 +
598 + $this->add_control(
599 + 'share_share_icon_area',
600 + [
601 + 'label' => __( 'Size', 'betterdocs' ),
602 + 'type' => Controls_Manager::SLIDER,
603 + 'size_units' => [ 'px' ],
604 + 'range' => [
605 + 'px' => [
606 + 'max' => 500,
607 + 'step' => 1
608 + ]
609 + ],
610 + 'selectors' => [
611 + '{{WRAPPER}} .betterdocs-social-share-links li a img' => 'height: {{SIZE}}px;width: {{SIZE}}px;'
612 + ]
613 + ]
614 + );
615 +
616 + $this->end_controls_section();
617 + }
618 +
619 + public function icon_style_layout_2() {
620 + $this->start_controls_section(
621 + 'section_icon_settings_layout_2',
622 + [
623 + 'label' => __( 'Icon', 'betterdocs' ),
624 + 'tab' => Controls_Manager::TAB_STYLE,
625 + 'condition' => [
626 + 'share_title_select_layout_layout' => [ 'layout-2' ]
627 + ]
628 + ]
629 + );
630 +
631 + $this->add_responsive_control(
632 + 'share_icon_space_layout_2', // Legacy control id but new control
633 + [
634 + 'label' => __( 'Spacing', 'betterdocs' ),
635 + 'type' => Controls_Manager::DIMENSIONS,
636 + 'size_units' => [ 'px', '%', 'em' ],
637 + 'selectors' => [
638 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2 li a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
639 + ]
640 + ]
641 + );
642 +
643 + $this->add_responsive_control(
644 + 'share_icon_padding_layout_2',
645 + [
646 + 'label' => __( 'Padding', 'betterdocs' ),
647 + 'type' => Controls_Manager::DIMENSIONS,
648 + 'size_units' => [ 'px', 'em', '%' ],
649 + 'selectors' => [
650 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2 li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
651 + ]
652 + ]
653 + );
654 +
655 + $this->add_control(
656 + 'share_share_icon_area_layout_2',
657 + [
658 + 'label' => __( 'Size', 'betterdocs' ),
659 + 'type' => Controls_Manager::SLIDER,
660 + 'size_units' => [ 'px' ],
661 + 'range' => [
662 + 'px' => [
663 + 'max' => 500,
664 + 'step' => 1
665 + ]
666 + ],
667 + 'selectors' => [
668 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2 li a, {{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2 li img' => 'height: {{SIZE}}px;width: {{SIZE}}px;'
669 + ]
670 + ]
671 + );
672 +
673 + $this->add_control(
674 + 'share_share_icon_inner_area_layout_2',
675 + [
676 + 'label' => __( 'Inner Size', 'betterdocs' ),
677 + 'type' => Controls_Manager::SLIDER,
678 + 'size_units' => [ 'px' ],
679 + 'range' => [
680 + 'px' => [
681 + 'max' => 500,
682 + 'step' => 1
683 + ]
684 + ],
685 + 'selectors' => [
686 + '{{WRAPPER}} .betterdocs-social-share.layout-2 .betterdocs-social-share-links.layout-2 li a img' => 'height: {{SIZE}}px;width: {{SIZE}}px;'
687 + ]
688 + ]
689 + );
690 +
691 + $this->end_controls_section();
692 + }
693 +
694 + protected function render_callback() {
695 + $settings = $this->attributes;
696 + if ( $settings['share_title_select_layout_layout'] == 'layout-1' ) {
697 + $this->views( 'widgets/social' );
698 + } else {
699 + $this->views( 'widgets/social-2' );
700 + }
701 + }
335 702 }