premium-banner.php
7 years ago
premium-blog.php
7 years ago
premium-button.php
7 years ago
premium-carousel.php
7 years ago
premium-contactform.php
7 years ago
premium-countdown.php
7 years ago
premium-counter.php
7 years ago
premium-dual-header.php
7 years ago
premium-fancytext.php
7 years ago
premium-grid.php
7 years ago
premium-image-button.php
7 years ago
premium-imageseparator.php
7 years ago
premium-maps.php
7 years ago
premium-modalbox.php
7 years ago
premium-person.php
7 years ago
premium-pricing-table.php
7 years ago
premium-progressbar.php
7 years ago
premium-testimonials.php
7 years ago
premium-title.php
7 years ago
premium-videobox.php
7 years ago
premium-button.php
830 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort. |
| 5 | |
| 6 | class Premium_Button_Widget extends Widget_Base |
| 7 | { |
| 8 | public function get_name() { |
| 9 | return 'premium-addon-button'; |
| 10 | } |
| 11 | |
| 12 | public function check_rtl(){ |
| 13 | return is_rtl(); |
| 14 | } |
| 15 | |
| 16 | public function getTemplateInstance() { |
| 17 | return $this->templateInstance = premium_Template_Tags::getInstance(); |
| 18 | } |
| 19 | |
| 20 | public function get_title() { |
| 21 | return \PremiumAddons\Helper_Functions::get_prefix() . ' Button'; |
| 22 | } |
| 23 | |
| 24 | public function get_icon() { |
| 25 | return 'pa-button'; |
| 26 | } |
| 27 | |
| 28 | public function get_categories() { |
| 29 | return [ 'premium-elements' ]; |
| 30 | } |
| 31 | |
| 32 | // Adding the controls fields for the premium button |
| 33 | // This will controls the animation, colors and background, dimensions etc |
| 34 | protected function _register_controls() { |
| 35 | |
| 36 | /*Start Button Content Section */ |
| 37 | $this->start_controls_section('premium_button_general_section', |
| 38 | [ |
| 39 | 'label' => esc_html__('Button', 'premium-addons-for-elementor'), |
| 40 | ] |
| 41 | ); |
| 42 | |
| 43 | /*Button Text*/ |
| 44 | $this->add_control('premium_button_text', |
| 45 | [ |
| 46 | 'label' => esc_html__('Text', 'premium-addons-for-elementor'), |
| 47 | 'type' => Controls_Manager::TEXT, |
| 48 | 'dynamic' => [ 'active' => true ], |
| 49 | 'default' => esc_html__('Click Me','premium-addons-for-elementor'), |
| 50 | 'label_block' => true, |
| 51 | ] |
| 52 | ); |
| 53 | |
| 54 | $this->add_control('premium_button_link_selection', |
| 55 | [ |
| 56 | 'label' => esc_html__('Link Type', 'premium-addons-for-elementor'), |
| 57 | 'type' => Controls_Manager::SELECT, |
| 58 | 'options' => [ |
| 59 | 'url' => esc_html__('URL', 'premium-addons-for-elementor'), |
| 60 | 'link' => esc_html__('Existing Page', 'premium-addons-for-elementor'), |
| 61 | ], |
| 62 | 'default' => 'url', |
| 63 | 'label_block' => true, |
| 64 | ] |
| 65 | ); |
| 66 | |
| 67 | $this->add_control('premium_button_link', |
| 68 | [ |
| 69 | 'label' => esc_html__('Link', 'premium-addons-for-elementor'), |
| 70 | 'type' => Controls_Manager::URL, |
| 71 | 'default' => [ |
| 72 | 'url' => '#', |
| 73 | ], |
| 74 | 'placeholder' => 'https://premiumaddons.com/', |
| 75 | 'label_block' => true, |
| 76 | 'separator' => 'after', |
| 77 | 'condition' => [ |
| 78 | 'premium_button_link_selection' => 'url' |
| 79 | ] |
| 80 | ] |
| 81 | ); |
| 82 | |
| 83 | $this->add_control('premium_button_existing_link', |
| 84 | [ |
| 85 | 'label' => esc_html__('Existing Page', 'premium-addons-for-elementor'), |
| 86 | 'type' => Controls_Manager::SELECT2, |
| 87 | 'options' => $this->getTemplateInstance()->get_all_post(), |
| 88 | 'condition' => [ |
| 89 | 'premium_button_link_selection' => 'link', |
| 90 | ], |
| 91 | 'multiple' => false, |
| 92 | 'separator' => 'after', |
| 93 | 'label_block' => true, |
| 94 | ] |
| 95 | ); |
| 96 | |
| 97 | /*Button Hover Effect*/ |
| 98 | $this->add_control('premium_button_hover_effect', |
| 99 | [ |
| 100 | 'label' => esc_html__('Hover Effect', 'premium-addons-for-elementor'), |
| 101 | 'type' => Controls_Manager::SELECT, |
| 102 | 'default' => 'none', |
| 103 | 'options' => [ |
| 104 | 'none' => esc_html__('None'), |
| 105 | 'style1' => esc_html__('Slide'), |
| 106 | 'style2' => esc_html__('Shutter'), |
| 107 | 'style3' => esc_html__('Icon Fade'), |
| 108 | 'style4' => esc_html__('Icon Slide'), |
| 109 | 'style5' => esc_html__('In & Out'), |
| 110 | ], |
| 111 | 'label_block' => true, |
| 112 | ] |
| 113 | ); |
| 114 | |
| 115 | $this->add_control('premium_button_style1_dir', |
| 116 | [ |
| 117 | 'label' => esc_html__('Slide Direction', 'premium-addons-for-elementor'), |
| 118 | 'type' => Controls_Manager::SELECT, |
| 119 | 'default' => 'bottom', |
| 120 | 'options' => [ |
| 121 | 'bottom' => esc_html__('Top to Bottom'), |
| 122 | 'top' => esc_html__('Bottom to Top'), |
| 123 | 'left' => esc_html__('Right to Left'), |
| 124 | 'right' => esc_html__('Left to Right'), |
| 125 | ], |
| 126 | 'condition' => [ |
| 127 | 'premium_button_hover_effect' => 'style1', |
| 128 | ], |
| 129 | 'label_block' => true, |
| 130 | ] |
| 131 | ); |
| 132 | |
| 133 | $this->add_control('premium_button_style2_dir', |
| 134 | [ |
| 135 | 'label' => esc_html__('Shutter Direction', 'premium-addons-for-elementor'), |
| 136 | 'type' => Controls_Manager::SELECT, |
| 137 | 'default' => 'shutouthor', |
| 138 | 'options' => [ |
| 139 | 'shutinhor' => esc_html__('Shutter in Horizontal'), |
| 140 | 'shutinver' => esc_html__('Shutter in Vertical'), |
| 141 | 'shutoutver' => esc_html__('Shutter out Horizontal'), |
| 142 | 'shutouthor' => esc_html__('Shutter out Vertical'), |
| 143 | 'scshutoutver' => esc_html__('Scaled Shutter Vertical'), |
| 144 | 'scshutouthor' => esc_html__('Scaled Shutter Horizontal'), |
| 145 | 'dshutinver' => esc_html__('Tilted Left'), |
| 146 | 'dshutinhor' => esc_html__('Tilted Right'), |
| 147 | |
| 148 | |
| 149 | ], |
| 150 | 'condition' => [ |
| 151 | 'premium_button_hover_effect' => 'style2', |
| 152 | ], |
| 153 | 'label_block' => true, |
| 154 | ] |
| 155 | ); |
| 156 | |
| 157 | $this->add_control('premium_button_style4_dir', |
| 158 | [ |
| 159 | 'label' => esc_html__('Slide Direction', 'premium-addons-for-elementor'), |
| 160 | 'type' => Controls_Manager::SELECT, |
| 161 | 'default' => 'bottom', |
| 162 | 'options' => [ |
| 163 | 'top' => esc_html__('Top'), |
| 164 | 'bottom' => esc_html__('Bottom'), |
| 165 | 'left' => esc_html__('Left'), |
| 166 | 'right' => esc_html__('Right'), |
| 167 | ], |
| 168 | 'condition' => [ |
| 169 | 'premium_button_hover_effect' => 'style4', |
| 170 | ], |
| 171 | 'label_block' => true, |
| 172 | ] |
| 173 | ); |
| 174 | |
| 175 | $this->add_control('premium_button_style5_dir', |
| 176 | [ |
| 177 | 'label' => esc_html__('Style', 'premium-addons-for-elementor'), |
| 178 | 'type' => Controls_Manager::SELECT, |
| 179 | 'default' => 'radialin', |
| 180 | 'options' => [ |
| 181 | 'radialin' => esc_html__('Radial In'), |
| 182 | 'radialout' => esc_html__('Radial Out'), |
| 183 | 'rectin' => esc_html__('Rectangle In'), |
| 184 | 'rectout' => esc_html__('Rectangle Out'), |
| 185 | ], |
| 186 | 'condition' => [ |
| 187 | 'premium_button_hover_effect' => 'style5', |
| 188 | ], |
| 189 | 'label_block' => true, |
| 190 | ] |
| 191 | ); |
| 192 | |
| 193 | /*Button Icon Switcher*/ |
| 194 | $this->add_control('premium_button_icon_switcher', |
| 195 | [ |
| 196 | 'label' => esc_html__('Icon', 'premium-addons-for-elementor'), |
| 197 | 'type' => Controls_Manager::SWITCHER, |
| 198 | 'condition' => [ |
| 199 | 'premium_button_hover_effect!' => 'style4' |
| 200 | ], |
| 201 | 'description' => esc_html__('Enable or disable button icon','premium-addons-for-elementor'), |
| 202 | ] |
| 203 | ); |
| 204 | |
| 205 | /*Button Icon Selection*/ |
| 206 | $this->add_control('premium_button_icon_selection', |
| 207 | [ |
| 208 | 'label' => esc_html__('Icon', 'premium-addons-for-elementor'), |
| 209 | 'type' => Controls_Manager::ICON, |
| 210 | 'default' => 'fa fa-bars', |
| 211 | 'condition' => [ |
| 212 | 'premium_button_icon_switcher' => 'yes', |
| 213 | 'premium_button_hover_effect!' => 'style4' |
| 214 | ], |
| 215 | 'label_block' => true, |
| 216 | ] |
| 217 | ); |
| 218 | |
| 219 | /*Style 4 Icon Selection*/ |
| 220 | $this->add_control('premium_button_style4_icon_selection', |
| 221 | [ |
| 222 | 'label' => esc_html__('Icon', 'premium-addons-for-elementor'), |
| 223 | 'type' => Controls_Manager::ICON, |
| 224 | 'default' => 'fa fa-bars', |
| 225 | 'condition' => [ |
| 226 | 'premium_button_hover_effect' => 'style4' |
| 227 | ], |
| 228 | 'label_block' => true, |
| 229 | ] |
| 230 | ); |
| 231 | |
| 232 | $this->add_control('premium_button_icon_position', |
| 233 | [ |
| 234 | 'label' => esc_html__('Icon Position', 'premium-addons-for-elementor'), |
| 235 | 'type' => Controls_Manager::SELECT, |
| 236 | 'default' => 'before', |
| 237 | 'options' => [ |
| 238 | 'before' => esc_html__('Before', 'premium-addons-for-elementor'), |
| 239 | 'after' => esc_html__('After', 'premium-addons-for-elementor'), |
| 240 | ], |
| 241 | 'condition' => [ |
| 242 | 'premium_button_icon_switcher' => 'yes', |
| 243 | 'premium_button_hover_effect!' => 'style4', |
| 244 | ], |
| 245 | 'label_block' => true, |
| 246 | ] |
| 247 | ); |
| 248 | |
| 249 | $this->add_control('premium_button_icon_before_size', |
| 250 | [ |
| 251 | 'label' => esc_html__('Icon Size', 'premium-addons-for-elementor'), |
| 252 | 'type' => Controls_Manager::SLIDER, |
| 253 | 'condition' => [ |
| 254 | 'premium_button_icon_switcher' => 'yes', |
| 255 | 'premium_button_hover_effect!' => 'style4' |
| 256 | ], |
| 257 | 'selectors' => [ |
| 258 | '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'font-size: {{SIZE}}px', |
| 259 | ] |
| 260 | ] |
| 261 | ); |
| 262 | |
| 263 | $this->add_control('premium_button_icon_style4_size', |
| 264 | [ |
| 265 | 'label' => esc_html__('Icon Size', 'premium-addons-for-elementor'), |
| 266 | 'type' => Controls_Manager::SLIDER, |
| 267 | 'condition' => [ |
| 268 | 'premium_button_hover_effect' => 'style4' |
| 269 | ], |
| 270 | 'selectors' => [ |
| 271 | '{{WRAPPER}} .premium-button-style4-icon-wrapper i' => 'font-size: {{SIZE}}px', |
| 272 | ] |
| 273 | ] |
| 274 | ); |
| 275 | |
| 276 | if(!$this->check_rtl()){ |
| 277 | $this->add_control('premium_button_icon_before_spacing', |
| 278 | [ |
| 279 | 'label' => esc_html__('Icon Spacing', 'premium-addons-for-elementor'), |
| 280 | 'type' => Controls_Manager::SLIDER, |
| 281 | 'condition' => [ |
| 282 | 'premium_button_icon_switcher' => 'yes', |
| 283 | 'premium_button_icon_position' => 'before', |
| 284 | 'premium_button_hover_effect!' => ['style3', 'style4'] |
| 285 | ], |
| 286 | 'default' => [ |
| 287 | 'size' => 15 |
| 288 | ], |
| 289 | 'selectors' => [ |
| 290 | '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'margin-right: {{SIZE}}px', |
| 291 | ], |
| 292 | 'separator' => 'after', |
| 293 | ] |
| 294 | ); |
| 295 | } |
| 296 | |
| 297 | if(!$this->check_rtl()){ |
| 298 | $this->add_control('premium_button_icon_after_spacing', |
| 299 | [ |
| 300 | 'label' => esc_html__('Icon Spacing', 'premium-addons-for-elementor'), |
| 301 | 'type' => Controls_Manager::SLIDER, |
| 302 | 'condition' => [ |
| 303 | 'premium_button_icon_switcher' => 'yes', |
| 304 | 'premium_button_icon_position' => 'after', |
| 305 | 'premium_button_hover_effect!' => ['style3', 'style4'] |
| 306 | ], |
| 307 | 'default' => [ |
| 308 | 'size' => 15 |
| 309 | ], |
| 310 | 'selectors' => [ |
| 311 | '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'margin-left: {{SIZE}}px', |
| 312 | ], |
| 313 | 'separator' => 'after', |
| 314 | ] |
| 315 | ); |
| 316 | } |
| 317 | |
| 318 | if($this->check_rtl()){ |
| 319 | $this->add_control('premium_button_icon_rtl_before_spacing', |
| 320 | [ |
| 321 | 'label' => esc_html__('Icon Spacing', 'premium-addons-for-elementor'), |
| 322 | 'type' => Controls_Manager::SLIDER, |
| 323 | 'condition' => [ |
| 324 | 'premium_button_icon_switcher' => 'yes', |
| 325 | 'premium_button_icon_position' => 'before', |
| 326 | 'premium_button_hover_effect!' => ['style3', 'style4'] |
| 327 | ], |
| 328 | 'default' => [ |
| 329 | 'size' => 15 |
| 330 | ], |
| 331 | 'selectors' => [ |
| 332 | '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'margin-left: {{SIZE}}px', |
| 333 | ], |
| 334 | 'separator' => 'after', |
| 335 | ] |
| 336 | ); |
| 337 | } |
| 338 | |
| 339 | if($this->check_rtl()){ |
| 340 | $this->add_control('premium_button_icon_rtl_after_spacing', |
| 341 | [ |
| 342 | 'label' => esc_html__('Icon Spacing', 'premium-addons-for-elementor'), |
| 343 | 'type' => Controls_Manager::SLIDER, |
| 344 | 'condition' => [ |
| 345 | 'premium_button_icon_switcher' => 'yes', |
| 346 | 'premium_button_icon_position' => 'after', |
| 347 | 'premium_button_hover_effect!' => ['style3', 'style4'] |
| 348 | ], |
| 349 | 'default' => [ |
| 350 | 'size' => 15 |
| 351 | ], |
| 352 | 'selectors' => [ |
| 353 | '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'margin-right: {{SIZE}}px', |
| 354 | ], |
| 355 | 'separator' => 'after', |
| 356 | ] |
| 357 | ); |
| 358 | } |
| 359 | |
| 360 | $this->add_control('premium_button_icon_style3_before_transition', |
| 361 | [ |
| 362 | 'label' => esc_html__('Icon Spacing', 'premium-addons-for-elementor'), |
| 363 | 'type' => Controls_Manager::SLIDER, |
| 364 | 'condition' => [ |
| 365 | 'premium_button_icon_switcher' => 'yes', |
| 366 | 'premium_button_icon_position' => 'before', |
| 367 | 'premium_button_hover_effect' => 'style3' |
| 368 | ], |
| 369 | 'range' => [ |
| 370 | 'px' => [ |
| 371 | 'min' => -50, |
| 372 | 'max' => 50, |
| 373 | ] |
| 374 | ], |
| 375 | 'selectors' => [ |
| 376 | '{{WRAPPER}} .premium-button-style3-before:hover i' => '-webkit-transform: translateX({{SIZE}}{{UNIT}}); transform: translateX({{SIZE}}{{UNIT}});', |
| 377 | ], |
| 378 | ] |
| 379 | ); |
| 380 | |
| 381 | $this->add_control('premium_button_icon_style3_after_transition', |
| 382 | [ |
| 383 | 'label' => esc_html__('Icon Spacing', 'premium-addons-for-elementor'), |
| 384 | 'type' => Controls_Manager::SLIDER, |
| 385 | 'condition' => [ |
| 386 | 'premium_button_icon_switcher' => 'yes', |
| 387 | 'premium_button_icon_position!'=> 'before', |
| 388 | 'premium_button_hover_effect' => 'style3' |
| 389 | ], |
| 390 | 'range' => [ |
| 391 | 'px' => [ |
| 392 | 'min' => -50, |
| 393 | 'max' => 50, |
| 394 | ] |
| 395 | ], |
| 396 | 'selectors' => [ |
| 397 | '{{WRAPPER}} .premium-button-style3-after:hover i' => '-webkit-transform: translateX({{SIZE}}{{UNIT}}); transform: translateX({{SIZE}}{{UNIT}});', |
| 398 | ], |
| 399 | ] |
| 400 | ); |
| 401 | |
| 402 | /*Button Size*/ |
| 403 | $this->add_control('premium_button_size', |
| 404 | [ |
| 405 | 'label' => esc_html__('Size', 'premium-addons-for-elementor'), |
| 406 | 'type' => Controls_Manager::SELECT, |
| 407 | 'default' => 'lg', |
| 408 | 'options' => [ |
| 409 | 'sm' => esc_html__('Small'), |
| 410 | 'md' => esc_html__('Medium'), |
| 411 | 'lg' => esc_html__('Large'), |
| 412 | 'block' => esc_html__('Block'), |
| 413 | ], |
| 414 | 'label_block' => true, |
| 415 | 'separator' => 'before', |
| 416 | ] |
| 417 | ); |
| 418 | |
| 419 | /*Button Align*/ |
| 420 | $this->add_responsive_control('premium_button_align', |
| 421 | [ |
| 422 | 'label' => esc_html__( 'Alignment', 'premium-addons-for-elementor' ), |
| 423 | 'type' => Controls_Manager::CHOOSE, |
| 424 | 'options' => [ |
| 425 | 'left' => [ |
| 426 | 'title' => __( 'Left', 'premium-addons-for-elementor' ), |
| 427 | 'icon' => 'fa fa-align-left', |
| 428 | ], |
| 429 | 'center' => [ |
| 430 | 'title' => __( 'Center', 'premium-addons-for-elementor' ), |
| 431 | 'icon' => 'fa fa-align-center', |
| 432 | ], |
| 433 | 'right' => [ |
| 434 | 'title' => __( 'Right', 'premium-addons-for-elementor' ), |
| 435 | 'icon' => 'fa fa-align-right', |
| 436 | ], |
| 437 | ], |
| 438 | 'selectors' => [ |
| 439 | '{{WRAPPER}} .premium-button-container' => 'text-align: {{VALUE}}', |
| 440 | ], |
| 441 | 'default' => 'center', |
| 442 | ] |
| 443 | ); |
| 444 | |
| 445 | $this->add_control('premium_button_event_switcher', |
| 446 | [ |
| 447 | 'label' => esc_html__('onclick Event', 'premium-addons-for-elementor'), |
| 448 | 'type' => Controls_Manager::SWITCHER, |
| 449 | 'separator' => 'before', |
| 450 | ] |
| 451 | ); |
| 452 | |
| 453 | $this->add_control('premium_button_event_function', |
| 454 | [ |
| 455 | 'label' => esc_html__('Example: myFunction();', 'premium-addons-for-elementor'), |
| 456 | 'type' => Controls_Manager::TEXTAREA, |
| 457 | 'condition' => [ |
| 458 | 'premium_button_event_switcher' => 'yes', |
| 459 | ], |
| 460 | ] |
| 461 | ); |
| 462 | |
| 463 | /*End Button General Section*/ |
| 464 | $this->end_controls_section(); |
| 465 | |
| 466 | /*Start Styling Section*/ |
| 467 | $this->start_controls_section('premium_button_style_section', |
| 468 | [ |
| 469 | 'label' => esc_html__('Button', 'premium-addons-for-elementor'), |
| 470 | 'tab' => Controls_Manager::TAB_STYLE, |
| 471 | ] |
| 472 | ); |
| 473 | |
| 474 | $this->add_group_control( |
| 475 | Group_Control_Typography::get_type(), |
| 476 | [ |
| 477 | 'name' => 'premium_button_typo', |
| 478 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 479 | 'selector' => '{{WRAPPER}} .premium-button', |
| 480 | ] |
| 481 | ); |
| 482 | |
| 483 | $this->start_controls_tabs('premium_button_style_tabs'); |
| 484 | |
| 485 | $this->start_controls_tab('premium_button_style_normal', |
| 486 | [ |
| 487 | 'label' => esc_html__('Normal', 'premium-addons-for-elementor'), |
| 488 | ] |
| 489 | ); |
| 490 | |
| 491 | $this->add_control('premium_button_text_color_normal', |
| 492 | [ |
| 493 | 'label' => esc_html__('Text Color', 'premium-addons-for-elementor'), |
| 494 | 'type' => Controls_Manager::COLOR, |
| 495 | 'scheme' => [ |
| 496 | 'type' => Scheme_Color::get_type(), |
| 497 | 'value' => Scheme_Color::COLOR_2, |
| 498 | ], |
| 499 | 'selectors' => [ |
| 500 | '{{WRAPPER}} .premium-button .premium-button-text-icon-wrapper span' => 'color: {{VALUE}};', |
| 501 | ] |
| 502 | ]); |
| 503 | |
| 504 | $this->add_control('premium_button_icon_color_normal', |
| 505 | [ |
| 506 | 'label' => esc_html__('Icon Color', 'premium-addons-for-elementor'), |
| 507 | 'type' => Controls_Manager::COLOR, |
| 508 | 'scheme' => [ |
| 509 | 'type' => Scheme_Color::get_type(), |
| 510 | 'value' => Scheme_Color::COLOR_2, |
| 511 | ], |
| 512 | 'selectors' => [ |
| 513 | '{{WRAPPER}} .premium-button-text-icon-wrapper i' => 'color: {{VALUE}};', |
| 514 | ], |
| 515 | 'condition' => [ |
| 516 | 'premium_button_icon_switcher' => 'yes', |
| 517 | 'premium_button_hover_effect!' => ['style3','style4'] |
| 518 | ] |
| 519 | ]); |
| 520 | |
| 521 | $this->add_control('premium_button_background_normal', |
| 522 | [ |
| 523 | 'label' => esc_html__('Background Color', 'premium-addons-for-elementor'), |
| 524 | 'type' => Controls_Manager::COLOR, |
| 525 | 'scheme' => [ |
| 526 | 'type' => Scheme_Color::get_type(), |
| 527 | 'value' => Scheme_Color::COLOR_1, |
| 528 | ], |
| 529 | 'selectors' => [ |
| 530 | '{{WRAPPER}} .premium-button, {{WRAPPER}} .premium-button.premium-button-style2-shutinhor:before , {{WRAPPER}} .premium-button.premium-button-style2-shutinver:before , {{WRAPPER}} .premium-button-style5-radialin:before , {{WRAPPER}} .premium-button-style5-rectin:before' => 'background-color: {{VALUE}};', |
| 531 | ] |
| 532 | ] |
| 533 | ); |
| 534 | |
| 535 | /*Button Border*/ |
| 536 | $this->add_group_control( |
| 537 | Group_Control_Border::get_type(), |
| 538 | [ |
| 539 | 'name' => 'premium_button_border_normal', |
| 540 | 'selector' => '{{WRAPPER}} .premium-button', |
| 541 | ] |
| 542 | ); |
| 543 | |
| 544 | /*Button Border Radius*/ |
| 545 | $this->add_control('premium_button_border_radius_normal', |
| 546 | [ |
| 547 | 'label' => esc_html__('Border Radius', 'premium-addons-for-elementor'), |
| 548 | 'type' => Controls_Manager::SLIDER, |
| 549 | 'size_units' => ['px', '%' ,'em'], |
| 550 | 'selectors' => [ |
| 551 | '{{WRAPPER}} .premium-button' => 'border-radius: {{SIZE}}{{UNIT}};' |
| 552 | ] |
| 553 | ] |
| 554 | ); |
| 555 | |
| 556 | /*Icon Shadow*/ |
| 557 | $this->add_group_control( |
| 558 | Group_Control_Text_Shadow::get_type(), |
| 559 | [ |
| 560 | 'label' => esc_html__('Icon Shadow','premium-addons-for-elementor'), |
| 561 | 'name' => 'premium_button_icon_shadow_normal', |
| 562 | 'selector' => '{{WRAPPER}} .premium-button-text-icon-wrapper i', |
| 563 | 'condition' => [ |
| 564 | 'premium_button_icon_switcher' => 'yes', |
| 565 | 'premium_button_hover_effect!' => ['style3', 'style4'] |
| 566 | ] |
| 567 | ] |
| 568 | ); |
| 569 | |
| 570 | /*Text Shadow*/ |
| 571 | $this->add_group_control( |
| 572 | Group_Control_Text_Shadow::get_type(), |
| 573 | [ |
| 574 | 'label' => esc_html__('Text Shadow','premium-addons-for-elementor'), |
| 575 | 'name' => 'premium_button_text_shadow_normal', |
| 576 | 'selector' => '{{WRAPPER}} .premium-button-text-icon-wrapper span', |
| 577 | ] |
| 578 | ); |
| 579 | |
| 580 | /*Button Shadow*/ |
| 581 | $this->add_group_control( |
| 582 | Group_Control_Box_Shadow::get_type(), |
| 583 | [ |
| 584 | 'label' => esc_html__('Button Shadow','premium-addons-for-elementor'), |
| 585 | 'name' => 'premium_button_box_shadow_normal', |
| 586 | 'selector' => '{{WRAPPER}} .premium-button', |
| 587 | ] |
| 588 | ); |
| 589 | |
| 590 | /*Button Margin*/ |
| 591 | $this->add_responsive_control('premium_button_margin_normal', |
| 592 | [ |
| 593 | 'label' => esc_html__('Margin', 'premium-addons-for-elementor'), |
| 594 | 'type' => Controls_Manager::DIMENSIONS, |
| 595 | 'size_units' => ['px', 'em', '%'], |
| 596 | 'selectors' => [ |
| 597 | '{{WRAPPER}} .premium-button' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 598 | ] |
| 599 | ]); |
| 600 | |
| 601 | /*Button Padding*/ |
| 602 | $this->add_responsive_control('premium_button_padding_normal', |
| 603 | [ |
| 604 | 'label' => esc_html__('Padding', 'premium-addons-for-elementor'), |
| 605 | 'type' => Controls_Manager::DIMENSIONS, |
| 606 | 'size_units' => ['px', 'em', '%'], |
| 607 | 'selectors' => [ |
| 608 | '{{WRAPPER}} .premium-button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 609 | ] |
| 610 | ]); |
| 611 | |
| 612 | $this->end_controls_tab(); |
| 613 | |
| 614 | $this->start_controls_tab('premium_button_style_hover', |
| 615 | [ |
| 616 | 'label' => esc_html__('Hover', 'premium-addons-for-elementor'), |
| 617 | ] |
| 618 | ); |
| 619 | |
| 620 | $this->add_control('premium_button_text_color_hover', |
| 621 | [ |
| 622 | 'label' => esc_html__('Text Color', 'premium-addons-for-elementor'), |
| 623 | 'type' => Controls_Manager::COLOR, |
| 624 | 'scheme' => [ |
| 625 | 'type' => Scheme_Color::get_type(), |
| 626 | 'value' => Scheme_Color::COLOR_1, |
| 627 | ], |
| 628 | 'selectors' => [ |
| 629 | '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper span' => 'color: {{VALUE}};', |
| 630 | ], |
| 631 | 'condition' => [ |
| 632 | 'premium_button_hover_effect!' => 'style4' |
| 633 | ] |
| 634 | ]); |
| 635 | |
| 636 | $this->add_control('premium_button_icon_color_hover', |
| 637 | [ |
| 638 | 'label' => esc_html__('Icon Color', 'premium-addons-for-elementor'), |
| 639 | 'type' => Controls_Manager::COLOR, |
| 640 | 'scheme' => [ |
| 641 | 'type' => Scheme_Color::get_type(), |
| 642 | 'value' => Scheme_Color::COLOR_2, |
| 643 | ], |
| 644 | 'selectors' => [ |
| 645 | '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper i' => 'color: {{VALUE}};', |
| 646 | ], |
| 647 | 'condition' => [ |
| 648 | 'premium_button_icon_switcher' => 'yes', |
| 649 | 'premium_button_hover_effect!' => 'style4', |
| 650 | ] |
| 651 | ]); |
| 652 | |
| 653 | $this->add_control('premium_button_style4_icon_color', |
| 654 | [ |
| 655 | 'label' => esc_html__('Icon Color', 'premium-addons-for-elementor'), |
| 656 | 'type' => Controls_Manager::COLOR, |
| 657 | 'scheme' => [ |
| 658 | 'type' => Scheme_Color::get_type(), |
| 659 | 'value' => Scheme_Color::COLOR_1, |
| 660 | ], |
| 661 | 'selectors' => [ |
| 662 | '{{WRAPPER}} .premium-button:hover .premium-button-style4-icon-wrapper' => 'color: {{VALUE}};', |
| 663 | ], |
| 664 | 'condition' => [ |
| 665 | 'premium_button_hover_effect' => 'style4' |
| 666 | ] |
| 667 | ]); |
| 668 | |
| 669 | $this->add_control('premium_button_background_hover', |
| 670 | [ |
| 671 | 'label' => esc_html__('Background Color', 'premium-addons-for-elementor'), |
| 672 | 'type' => Controls_Manager::COLOR, |
| 673 | 'scheme' => [ |
| 674 | 'type' => Scheme_Color::get_type(), |
| 675 | 'value' => Scheme_Color::COLOR_3 |
| 676 | ], |
| 677 | 'selectors' => [ |
| 678 | '' |
| 679 | . '{{WRAPPER}} .premium-button-none:hover ,{{WRAPPER}} .premium-button-style1-bottom:before, {{WRAPPER}} .premium-button-style1-top:before, {{WRAPPER}} .premium-button-style1-right:before, {{WRAPPER}} .premium-button-style1-left:before, {{WRAPPER}} .premium-button-style2-shutouthor:before, {{WRAPPER}} .premium-button-style2-shutoutver:before, {{WRAPPER}} .premium-button-style2-shutinhor, {{WRAPPER}} .premium-button-style2-shutinver , {{WRAPPER}} .premium-button-style2-dshutinhor:before , {{WRAPPER}} .premium-button-style2-dshutinver:before , {{WRAPPER}} .premium-button-style2-scshutouthor:before , {{WRAPPER}} .premium-button-style2-scshutoutver:before, {{WRAPPER}} .premium-button-style3-after:hover , {{WRAPPER}} .premium-button-style3-before:hover,{{WRAPPER}} .premium-button-style4-icon-wrapper , {{WRAPPER}} .premium-button-style5-radialin , {{WRAPPER}} .premium-button-style5-radialout:before, {{WRAPPER}} .premium-button-style5-rectin , {{WRAPPER}} .premium-button-style5-rectout:before' => 'background-color: {{VALUE}};', |
| 680 | ], |
| 681 | ] |
| 682 | ); |
| 683 | |
| 684 | /*Button Border*/ |
| 685 | $this->add_group_control( |
| 686 | Group_Control_Border::get_type(), |
| 687 | [ |
| 688 | 'name' => 'premium_button_border_hover', |
| 689 | 'selector' => '{{WRAPPER}} .premium-button:hover', |
| 690 | ] |
| 691 | ); |
| 692 | |
| 693 | /*Button Border Radius*/ |
| 694 | $this->add_control('premium_button_border_radius_hover', |
| 695 | [ |
| 696 | 'label' => esc_html__('Border Radius', 'premium-addons-for-elementor'), |
| 697 | 'type' => Controls_Manager::SLIDER, |
| 698 | 'size_units' => ['px', '%' ,'em'], |
| 699 | 'selectors' => [ |
| 700 | '{{WRAPPER}} .premium-button:hover' => 'border-radius: {{SIZE}}{{UNIT}};' |
| 701 | ] |
| 702 | ] |
| 703 | ); |
| 704 | |
| 705 | /*Icon Shadow*/ |
| 706 | $this->add_group_control( |
| 707 | Group_Control_Text_Shadow::get_type(), |
| 708 | [ |
| 709 | 'label' => esc_html__('Icon Shadow','premium-addons-for-elementor'), |
| 710 | 'name' => 'premium_button_icon_shadow_hover', |
| 711 | 'selector' => '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper i', |
| 712 | 'condition' => [ |
| 713 | 'premium_button_icon_switcher' => 'yes', |
| 714 | 'premium_button_hover_effect!' => 'style4', |
| 715 | ] |
| 716 | ] |
| 717 | ); |
| 718 | |
| 719 | $this->add_group_control( |
| 720 | Group_Control_Text_Shadow::get_type(), |
| 721 | [ |
| 722 | 'label' => esc_html__('Icon Shadow','premium-addons-for-elementor'), |
| 723 | 'name' => 'premium_button_style4_icon_shadow_hover', |
| 724 | 'selector' => '{{WRAPPER}} .premium-button:hover .premium-button-style4-icon-wrapper', |
| 725 | 'condition' => [ |
| 726 | 'premium_button_hover_effect' => 'style4', |
| 727 | ] |
| 728 | ] |
| 729 | ); |
| 730 | |
| 731 | /*Text Shadow*/ |
| 732 | $this->add_group_control( |
| 733 | Group_Control_Text_Shadow::get_type(), |
| 734 | [ |
| 735 | 'label' => esc_html__('Text Shadow','premium-addons-for-elementor'), |
| 736 | 'name' => 'premium_button_text_shadow_hover', |
| 737 | 'selector' => '{{WRAPPER}} .premium-button:hover .premium-button-text-icon-wrapper span', |
| 738 | 'condition' => [ |
| 739 | 'premium_button_hover_effect!' => 'style4' |
| 740 | ] |
| 741 | ] |
| 742 | ); |
| 743 | |
| 744 | /*Button Shadow*/ |
| 745 | $this->add_group_control( |
| 746 | Group_Control_Box_Shadow::get_type(), |
| 747 | [ |
| 748 | 'label' => esc_html__('Button Shadow','premium-addons-for-elementor'), |
| 749 | 'name' => 'premium_button_box_shadow_hover', |
| 750 | 'selector' => '{{WRAPPER}} .premium-button:hover', |
| 751 | ] |
| 752 | ); |
| 753 | |
| 754 | /*Button Margin*/ |
| 755 | $this->add_responsive_control('premium_button_margin_hover', |
| 756 | [ |
| 757 | 'label' => esc_html__('Margin', 'premium-addons-for-elementor'), |
| 758 | 'type' => Controls_Manager::DIMENSIONS, |
| 759 | 'size_units' => ['px', 'em', '%'], |
| 760 | 'selectors' => [ |
| 761 | '{{WRAPPER}} .premium-button:hover' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 762 | ] |
| 763 | ]); |
| 764 | |
| 765 | /*Button Padding*/ |
| 766 | $this->add_responsive_control('premium_button_padding_hover', |
| 767 | [ |
| 768 | 'label' => esc_html__('Padding', 'premium-addons-for-elementor'), |
| 769 | 'type' => Controls_Manager::DIMENSIONS, |
| 770 | 'size_units' => ['px', 'em', '%'], |
| 771 | 'selectors' => [ |
| 772 | '{{WRAPPER}} .premium-button:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 773 | ] |
| 774 | ]); |
| 775 | |
| 776 | $this->end_controls_tab(); |
| 777 | |
| 778 | $this->end_controls_tabs(); |
| 779 | |
| 780 | /*End Button Style Section*/ |
| 781 | $this->end_controls_section(); |
| 782 | } |
| 783 | |
| 784 | protected function render($instance = []) |
| 785 | { |
| 786 | // get our input from the widget settings. |
| 787 | $settings = $this->get_settings_for_display(); |
| 788 | |
| 789 | $this->add_inline_editing_attributes( 'premium_button_text'); |
| 790 | |
| 791 | $button_text = $settings['premium_button_text']; |
| 792 | |
| 793 | if($settings['premium_button_link_selection'] == 'url'){ |
| 794 | $button_url = $settings['premium_button_link']['url']; |
| 795 | } else { |
| 796 | $button_url = get_permalink($settings['premium_button_existing_link']); |
| 797 | } |
| 798 | |
| 799 | |
| 800 | $button_size = 'premium-button-' . $settings['premium_button_size']; |
| 801 | |
| 802 | $button_event = $settings['premium_button_event_function']; |
| 803 | |
| 804 | $button_icon = $settings['premium_button_icon_selection']; |
| 805 | |
| 806 | if ($settings['premium_button_hover_effect'] == 'none'){ |
| 807 | $style_dir = 'premium-button-none'; |
| 808 | } elseif($settings['premium_button_hover_effect'] == 'style1'){ |
| 809 | $style_dir = 'premium-button-style1-' . $settings['premium_button_style1_dir']; |
| 810 | } elseif ($settings['premium_button_hover_effect'] == 'style2'){ |
| 811 | $style_dir = 'premium-button-style2-' . $settings['premium_button_style2_dir']; |
| 812 | } elseif ($settings['premium_button_hover_effect'] == 'style3') { |
| 813 | $style_dir = 'premium-button-style3-' . $settings['premium_button_icon_position']; |
| 814 | } elseif ($settings['premium_button_hover_effect'] == 'style4') { |
| 815 | $style_dir = 'premium-button-style4-' . $settings['premium_button_style4_dir']; |
| 816 | $slide_icon = $settings['premium_button_style4_icon_selection']; |
| 817 | } elseif ($settings['premium_button_hover_effect'] == 'style5'){ |
| 818 | $style_dir = 'premium-button-style5-' . $settings['premium_button_style5_dir']; |
| 819 | } |
| 820 | ?> |
| 821 | |
| 822 | <div class="premium-button-container"> |
| 823 | <a class="premium-button <?php echo esc_attr($button_size); ?> <?php echo esc_attr($style_dir);?>" <?php if(!empty($button_url)) : ?>href="<?php echo esc_url($button_url); ?>"<?php endif;?><?php if(!empty($settings['premium_button_link']['is_external'])) : ?>target="_blank"<?php endif; ?><?php if(!empty($settings['premium_button_link']['nofollow'])) : ?>rel="nofollow"<?php endif; ?><?php if(!empty($settings['premium_button_event_function']) && $settings['premium_button_event_switcher']) : ?> onclick="<?php echo esc_js($button_event); ?>"<?php endif ?>><div class="premium-button-text-icon-wrapper"><?php if($settings['premium_button_icon_switcher'] && $settings['premium_button_icon_position'] == 'before'&& $settings['premium_button_hover_effect'] != 'style4' &&!empty($settings['premium_button_icon_selection'])) : ?><i class="fa <?php echo esc_attr($button_icon); ?>"></i><?php endif; ?><span <?php echo $this->get_render_attribute_string( 'premium_button_text' ); ?>><?php echo $button_text; ?></span><?php if($settings['premium_button_icon_switcher'] && $settings['premium_button_icon_position'] == 'after' && $settings['premium_button_hover_effect'] != 'style4' &&!empty($settings['premium_button_icon_selection'])) : ?><i class="fa <?php echo esc_attr($button_icon); ?>"></i><?php endif; ?></div> |
| 824 | <?php if($settings['premium_button_hover_effect'] == 'style4') : ?><div class="premium-button-style4-icon-wrapper <?php echo esc_attr($settings['premium_button_style4_dir']); ?>"><i class="fa <?php echo esc_attr($slide_icon); ?>"></i></div><?php endif; ?></a> |
| 825 | </div> |
| 826 | |
| 827 | <?php |
| 828 | } |
| 829 | } |
| 830 | Plugin::instance()->widgets_manager->register_widget_type(new Premium_Button_Widget()); |