PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 2.0.1
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v2.0.1
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 3.5.1 All 200 releases
betterdocs / includes / elementor / widgets / betterdocs-elementor-doc-share.php

betterdocs-elementor-doc-share.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 2.0.1, at includes/elementor/widgets/betterdocs-elementor-doc-share.php

338 lines 10.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 use Elementor\Controls_Manager;
4 use Elementor\Group_Control_Typography;
5 use Elementor\Widget_Base;
6 use Elementor\Group_Control_Background;
7 use Elementor\Group_Control_Border as Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow as Group_Control_Box_Shadow;
9
10 if (!defined('ABSPATH')) {
11 exit; // Exit if accessed directly
12 }
13
14 class BetterDocs_Elementor_Doc_Share extends Widget_Base {
15
16 public function get_name () {
17 return 'betterdocs-doc-share';
18 }
19
20 public function get_title () {
21 return __('Doc Share', 'betterdocs');
22 }
23
24 public function get_icon () {
25 return 'betterdocs-icon-Social-Share';
26 }
27
28 public function get_categories () {
29 return ['betterdocs-elements'];
30 }
31
32 public function get_keywords () {
33 return ['betterdocs-elements', 'share', 'betterdocs', 'heading', 'docs'];
34 }
35
36 public function get_custom_help_url() {
37 return 'https://betterdocs.co/docs/single-doc-in-elementor';
38 }
39
40 protected function _register_controls () {
41
42 $this->share_controls();
43
44 $this->start_controls_section(
45 'section_column_settings',
46 [
47 'label' => __('Box Style', 'betterdocs'),
48 'tab' => Controls_Manager::TAB_STYLE,
49 ]
50 );
51
52 $this->add_control(
53 'share_box_width',
54 [
55 'label' => __('Width', 'betterdocs'),
56 'type' => Controls_Manager::SLIDER,
57 'size_units' => ['px', '%', 'em'],
58 'range' => [
59 'px' => [
60 'min' => 0,
61 'max' => 2000,
62 'step' => 1
63 ],
64 '%' => [
65 'min' => 0,
66 'max' => 100,
67 'step' => 1
68 ],
69 'em' => [
70 'min' => 100,
71 'max' => 100,
72 'step' => 1
73 ],
74 ],
75 'default' => [
76 'unit' => '%',
77 'size' => 100
78 ],
79 'selectors' => [
80 '{{WRAPPER}} .betterdocs-social-share' => 'width: {{SIZE}}{{UNIT}};',
81 ],
82 ]
83 );
84
85 $this->add_control(
86 'share_box_height',
87 [
88 'label' => __('Height', 'betterdocs'),
89 'type' => Controls_Manager::SLIDER,
90 'size_units' => ['px'],
91 'range' => [
92 'px' => [
93 'max' => 500,
94 'step' => 1,
95 ],
96 ],
97 'selectors' => [
98 '{{WRAPPER}} .betterdocs-social-share' => 'height: {{SIZE}}px;',
99 ],
100 ]
101 );
102
103 $this->add_group_control(
104 Group_Control_Background::get_type(),
105 [
106 'name' => 'share_box_background',
107 'types' => ['classic', 'gradient'],
108 'selector' => '{{WRAPPER}} .betterdocs-social-share'
109 ]
110 );
111
112 $this->add_responsive_control(
113 'share_box_space', // Legacy control id but new control
114 [
115 'label' => __('Box Spacing', 'betterdocs'),
116 'type' => Controls_Manager::DIMENSIONS,
117 'size_units' => ['px', '%', 'em'],
118 'selectors' => [
119 '{{WRAPPER}} .betterdocs-social-share' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
120 ]
121 ]
122 );
123
124 $this->add_responsive_control(
125 'share_box_padding',
126 [
127 'label' => __('Box Padding', 'betterdocs'),
128 'type' => Controls_Manager::DIMENSIONS,
129 'size_units' => ['px', 'em', '%'],
130 'selectors' => [
131 '{{WRAPPER}} .betterdocs-social-share' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
132 ],
133 ]
134 );
135
136 $this->add_group_control(
137 Group_Control_Border::get_type(),
138 [
139 'name' => 'share_box_border_normal',
140 'label' => esc_html__('Border', 'betterdocs'),
141 'selector' => '{{WRAPPER}} .betterdocs-social-share'
142 ]
143 );
144
145 $this->add_responsive_control(
146 'share_box_radius_normal',
147 [
148 'label' => esc_html__('Border Radius', 'betterdocs'),
149 'type' => Controls_Manager::DIMENSIONS,
150 'size_units' => ['px', 'em', '%'],
151 'selectors' => [
152 '{{WRAPPER}} .betterdocs-social-share' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
153 ],
154 ]
155 );
156
157 $this->add_group_control(
158 Group_Control_Box_Shadow::get_type(),
159 [
160 'name' => 'share_box_shadow_normal',
161 'selector' => '{{WRAPPER}} .betterdocs-social-share'
162 ]
163 );
164
165 $this->end_controls_section();
166
167 $this->start_controls_section(
168 'section_title_settings',
169 [
170 'label' => __('Title', 'betterdocs'),
171 'tab' => Controls_Manager::TAB_STYLE,
172 ]
173 );
174
175 $this->add_control(
176 'share_box_title_color',
177 [
178 'label' => esc_html__('Color', 'betterdocs'),
179 'type' => Controls_Manager::COLOR,
180 'selectors' => [
181 '{{WRAPPER}} .betterdocs-social-share-heading h5' => 'color: {{VALUE}};',
182 ],
183 ]
184 );
185
186 $this->add_group_control(
187 Group_Control_Typography::get_type(),
188 [
189 'name' => 'share_box_title_typography',
190 'selector' => '{{WRAPPER}} .betterdocs-social-share-heading h5'
191 ]
192 );
193
194 $this->end_controls_section();
195
196 $this->icon_style();
197 }
198
199 public function share_controls()
200 {
201 $this->start_controls_section(
202 'section_options',
203 [
204 'label' => __('Controls', 'betterdocs')
205 ]
206 );
207
208 $this->add_control(
209 'share_title',
210 [
211 'label' => __( 'Title', 'betterdocs' ),
212 'type' => Controls_Manager::TEXT,
213 'default' => __( 'Share This Article :', 'betterdocs' ),
214 'placeholder' => __( 'Type share title here', 'betterdocs' ),
215 ]
216 );
217
218 $this->add_control(
219 'facebook',
220 [
221 'label' => __( 'Facebook', 'betterdocs' ),
222 'type' => Controls_Manager::SWITCHER,
223 'label_on' => __( 'Show', 'betterdocs' ),
224 'label_off' => __( 'Hide', 'betterdocs' ),
225 'return_value' => '1',
226 'default' => '1',
227 ]
228 );
229
230 $this->add_control(
231 'twitter',
232 [
233 'label' => __( 'Twitter', 'betterdocs' ),
234 'type' => Controls_Manager::SWITCHER,
235 'label_on' => __( 'Show', 'betterdocs' ),
236 'label_off' => __( 'Hide', 'betterdocs' ),
237 'return_value' => '1',
238 'default' => '1',
239 ]
240 );
241
242 $this->add_control(
243 'linkedin',
244 [
245 'label' => __( 'Linkedin', 'betterdocs' ),
246 'type' => Controls_Manager::SWITCHER,
247 'label_on' => __( 'Show', 'betterdocs' ),
248 'label_off' => __( 'Hide', 'betterdocs' ),
249 'return_value' => '1',
250 'default' => '1',
251 ]
252 );
253
254 $this->add_control(
255 'pinterest',
256 [
257 'label' => __( 'Pinterest', 'betterdocs' ),
258 'type' => Controls_Manager::SWITCHER,
259 'label_on' => __( 'Show', 'betterdocs' ),
260 'label_off' => __( 'Hide', 'betterdocs' ),
261 'return_value' => '1',
262 'default' => '1',
263 ]
264 );
265
266 $this->end_controls_section();
267 }
268
269 public function icon_style(){
270 $this->start_controls_section(
271 'section_icon_settings',
272 [
273 'label' => __('Icon', 'betterdocs'),
274 'tab' => Controls_Manager::TAB_STYLE,
275 ]
276 );
277
278 $this->add_responsive_control(
279 'share_icon_space', // Legacy control id but new control
280 [
281 'label' => __('Spacing', 'betterdocs'),
282 'type' => Controls_Manager::DIMENSIONS,
283 'size_units' => ['px', '%', 'em'],
284 'selectors' => [
285 '{{WRAPPER}} .betterdocs-social-share-links li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
286 ]
287 ]
288 );
289
290 $this->add_responsive_control(
291 'share_icon_padding',
292 [
293 'label' => __('Padding', 'betterdocs'),
294 'type' => Controls_Manager::DIMENSIONS,
295 'size_units' => ['px', 'em', '%'],
296 'selectors' => [
297 '{{WRAPPER}} .betterdocs-social-share-links li' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
298 ],
299 ]
300 );
301
302 $this->add_control(
303 'share_share_icon_area',
304 [
305 'label' => __('Size', 'betterdocs'),
306 'type' => Controls_Manager::SLIDER,
307 'size_units' => ['px'],
308 'range' => [
309 'px' => [
310 'max' => 500,
311 'step' => 1,
312 ],
313 ],
314 'selectors' => [
315 '{{WRAPPER}} .betterdocs-social-share-links li a img' => 'height: {{SIZE}}px;width: {{SIZE}}px;',
316 ],
317 ]
318 );
319
320
321 $this->end_controls_section();
322 }
323
324 protected function render () {
325 $settings = $this->get_settings_for_display();
326 echo '<div class="betterdocs-el-single-share">';
327 echo do_shortcode(
328 "[betterdocs_social_share
329 title='{$settings['share_title']}'
330 facebook_sharing='{$settings['facebook']}'
331 twitter_sharing='{$settings['twitter']}'
332 linkedin_sharing='{$settings['linkedin']}'
333 pinterest_sharing='{$settings['pinterest']}']"
334 );
335 echo '</div>';
336 }
337 }
338