| 1 |
<?php |
| 2 |
namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; // Exit if accessed directly |
| 6 |
} |
| 7 |
|
| 8 |
use Elementor\Controls_Manager; |
| 9 |
use Elementor\Group_Control_Background; |
| 10 |
use Elementor\Group_Control_Typography; |
| 11 |
use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget; |
| 12 |
use Elementor\Group_Control_Border; |
| 13 |
use WPDeveloper\BetterDocs\Traits\SocialShare as SocialShareTrait; |
| 14 |
use Elementor\Group_Control_Box_Shadow; |
| 15 |
|
| 16 |
class DocShare extends BaseWidget { |
| 17 |
use SocialShareTrait; |
| 18 |
|
| 19 |
protected $map_view_vars = [ |
| 20 |
'share_title' => 'title', |
| 21 |
'share_title_tag' => 'title_tag' |
| 22 |
]; |
| 23 |
|
| 24 |
public function get_name() { |
| 25 |
return 'betterdocs-doc-share'; |
| 26 |
} |
| 27 |
|
| 28 |
public function get_title() { |
| 29 |
return __( 'Doc Share', 'betterdocs' ); |
| 30 |
} |
| 31 |
|
| 32 |
public function get_icon() { |
| 33 |
return 'betterdocs-icon-Social-Share'; |
| 34 |
} |
| 35 |
|
| 36 |
public function get_categories() { |
| 37 |
return [ 'betterdocs-elements-single' ]; |
| 38 |
} |
| 39 |
|
| 40 |
public function get_keywords() { |
| 41 |
return [ 'betterdocs-elements', 'share', 'betterdocs', 'heading', 'docs' ]; |
| 42 |
} |
| 43 |
|
| 44 |
public function get_style_depends() { |
| 45 |
return [ 'betterdocs-social-share' ]; |
| 46 |
} |
| 47 |
|
| 48 |
public function get_custom_help_url() { |
| 49 |
return 'https://betterdocs.co/docs/single-doc-in-elementor'; |
| 50 |
} |
| 51 |
|
| 52 |
protected function register_controls() { |
| 53 |
$this->share_controls(); |
| 54 |
|
| 55 |
$this->box_style_layout_1(); |
| 56 |
$this->box_container_wrapper(); |
| 57 |
$this->box_style_layout_2(); |
| 58 |
|
| 59 |
$this->box_title_layout_1(); |
| 60 |
$this->box_title_layout_2(); |
| 61 |
|
| 62 |
$this->icon_style(); |
| 63 |
$this->icon_style_layout_2(); |
| 64 |
} |
| 65 |
|
| 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 |
); |
| 77 |
|
| 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 |
); |
| 110 |
|
| 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 |
); |
| 128 |
|
| 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 |
); |
| 137 |
|
| 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 |
); |
| 149 |
|
| 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 |
); |
| 161 |
|
| 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 |
); |
| 170 |
|
| 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 |
); |
| 182 |
|
| 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 |
); |
| 190 |
|
| 191 |
$this->end_controls_section(); |
| 192 |
} |
| 193 |
|
| 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 |
|
| 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 |
); |
| 217 |
|
| 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 |
); |
| 229 |
|
| 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 |
); |
| 238 |
|
| 239 |
$this->end_controls_section(); |
| 240 |
} |
| 241 |
|
| 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 |
); |
| 253 |
|
| 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 |
); |
| 286 |
|
| 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 |
); |
| 304 |
|
| 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 |
); |
| 313 |
|
| 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 |
); |
| 325 |
|
| 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 |
); |
| 337 |
|
| 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 |
); |
| 346 |
|
| 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 |
); |
| 358 |
|
| 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 |
); |
| 366 |
|
| 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 |
} |
| 702 |
} |
| 703 |
|