theme-elements
6 years ago
accordion.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
carousel-navigation.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
gallery.php
6 years ago
gmap.php
6 years ago
heading-modern.php
6 years ago
icon.php
6 years ago
image.php
6 years ago
mailchimp.php
6 years ago
modern-button.php
6 years ago
quote.php
6 years ago
recent-comments.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-products.php
6 years ago
responsive-table.php
6 years ago
search.php
6 years ago
staff.php
6 years ago
svg.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
modern-button.php
791 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Icons_Manager; |
| 9 | use Elementor\Scheme_Typography; |
| 10 | use Elementor\Group_Control_Background; |
| 11 | use Elementor\Group_Control_Box_Shadow; |
| 12 | use Elementor\Group_Control_Text_Shadow; |
| 13 | |
| 14 | |
| 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | exit; // Exit if accessed directly. |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Elementor 'ModernButton' widget. |
| 21 | * |
| 22 | * Elementor widget that displays an 'ModernButton' with lightbox. |
| 23 | * |
| 24 | * @since 1.0.0 |
| 25 | */ |
| 26 | class ModernButton extends Widget_Base { |
| 27 | |
| 28 | /** |
| 29 | * Get widget name. |
| 30 | * |
| 31 | * Retrieve 'ModernButton' widget name. |
| 32 | * |
| 33 | * @since 1.0.0 |
| 34 | * @access public |
| 35 | * |
| 36 | * @return string Widget name. |
| 37 | */ |
| 38 | public function get_name() { |
| 39 | return 'aux_modern_button'; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Get widget title. |
| 44 | * |
| 45 | * Retrieve 'ModernButton' widget title. |
| 46 | * |
| 47 | * @since 1.0.0 |
| 48 | * @access public |
| 49 | * |
| 50 | * @return string Widget title. |
| 51 | */ |
| 52 | public function get_title() { |
| 53 | return __('Modern Button', 'auxin-elements' ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Get widget icon. |
| 58 | * |
| 59 | * Retrieve 'ModernButton' widget icon. |
| 60 | * |
| 61 | * @since 1.0.0 |
| 62 | * @access public |
| 63 | * |
| 64 | * @return string Widget icon. |
| 65 | */ |
| 66 | public function get_icon() { |
| 67 | return 'eicon-button auxin-badge'; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Get widget categories. |
| 72 | * |
| 73 | * Retrieve 'ModernButton' widget icon. |
| 74 | * |
| 75 | * @since 1.0.0 |
| 76 | * @access public |
| 77 | * |
| 78 | * @return string Widget icon. |
| 79 | */ |
| 80 | public function get_categories() { |
| 81 | return [ 'auxin-core' ]; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Register 'ModernButton' widget controls. |
| 86 | * |
| 87 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 88 | * |
| 89 | * @since 1.0.0 |
| 90 | * @access protected |
| 91 | */ |
| 92 | protected function _register_controls() { |
| 93 | |
| 94 | /*-----------------------------------------------------------------------------------*/ |
| 95 | /* Button |
| 96 | /*-----------------------------------------------------------------------------------*/ |
| 97 | |
| 98 | $this->start_controls_section( |
| 99 | 'button_section', |
| 100 | [ |
| 101 | 'label' => __('Button', 'auxin-elements' ), |
| 102 | ] |
| 103 | ); |
| 104 | |
| 105 | $this->add_control( |
| 106 | 'label', |
| 107 | [ |
| 108 | 'label' => __('Label','auxin-elements' ), |
| 109 | 'type' => Controls_Manager::TEXT, |
| 110 | 'default' => __('Click Here','auxin-elements' ), |
| 111 | ] |
| 112 | ); |
| 113 | |
| 114 | $this->add_control( |
| 115 | 'link', |
| 116 | [ |
| 117 | 'label' => __('Link','auxin-elements' ), |
| 118 | 'type' => Controls_Manager::URL, |
| 119 | 'placeholder' => 'https://your-link.com', |
| 120 | 'show_external' => true, |
| 121 | 'dynamic' => [ |
| 122 | 'active' => true |
| 123 | ] |
| 124 | ] |
| 125 | ); |
| 126 | |
| 127 | $this->add_control( |
| 128 | 'open_video_in_lightbox', |
| 129 | array( |
| 130 | 'label' => __('Open Video in Lightbox','auxin-elements' ), |
| 131 | 'type' => Controls_Manager::SWITCHER, |
| 132 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 133 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 134 | 'return_value' => 'yes', |
| 135 | 'default' => '' |
| 136 | ) |
| 137 | ); |
| 138 | |
| 139 | $this->add_responsive_control( |
| 140 | 'btn_align', |
| 141 | [ |
| 142 | 'label' => __( 'Alignment', 'auxin-elements' ), |
| 143 | 'type' => Controls_Manager::CHOOSE, |
| 144 | 'options' => [ |
| 145 | 'left' => [ |
| 146 | 'title' => __( 'Left', 'auxin-elements' ), |
| 147 | 'icon' => 'eicon-text-align-left', |
| 148 | ], |
| 149 | 'center' => [ |
| 150 | 'title' => __( 'Center', 'auxin-elements' ), |
| 151 | 'icon' => 'eicon-text-align-center', |
| 152 | ], |
| 153 | 'right' => [ |
| 154 | 'title' => __( 'Right', 'auxin-elements' ), |
| 155 | 'icon' => 'eicon-text-align-right', |
| 156 | ], |
| 157 | 'justify' => [ |
| 158 | 'title' => __( 'Justified', 'auxin-elements' ), |
| 159 | 'icon' => 'eicon-text-align-justify', |
| 160 | ], |
| 161 | ], |
| 162 | 'default' => 'left', |
| 163 | ] |
| 164 | ); |
| 165 | |
| 166 | $this->add_control( |
| 167 | 'icon_divider', |
| 168 | [ |
| 169 | 'label' => __( 'Icon', 'auxin-elements' ), |
| 170 | 'type' => Controls_Manager::HEADING, |
| 171 | 'separator' => 'before' |
| 172 | ] |
| 173 | ); |
| 174 | |
| 175 | $this->add_control( |
| 176 | 'icon_display', |
| 177 | [ |
| 178 | 'label' => __( 'Display Icon', 'auxin-elements' ), |
| 179 | 'type' => Controls_Manager::SWITCHER, |
| 180 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 181 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 182 | 'return_value' => 'yes', |
| 183 | 'default' => 'no', |
| 184 | 'separator' => 'before' |
| 185 | ] |
| 186 | ); |
| 187 | |
| 188 | $this->add_control( |
| 189 | 'icon', |
| 190 | [ |
| 191 | 'type' => Controls_Manager::ICONS, |
| 192 | 'default' => [ |
| 193 | 'value' => 'auxicon-arrow-down', |
| 194 | 'library' => 'auxicon' |
| 195 | ], |
| 196 | 'condition' => [ |
| 197 | 'icon_display' => 'yes' |
| 198 | ], |
| 199 | ] |
| 200 | ); |
| 201 | |
| 202 | $this->end_controls_section(); |
| 203 | |
| 204 | /*-----------------------------------------------------------------------------------*/ |
| 205 | /* Button Style Section |
| 206 | /*-----------------------------------------------------------------------------------*/ |
| 207 | |
| 208 | $this->start_controls_section( |
| 209 | 'section_style_btn', |
| 210 | [ |
| 211 | 'label' => __('Button', 'auxin-elements' ), |
| 212 | 'tab' => Controls_Manager::TAB_STYLE, |
| 213 | ] |
| 214 | ); |
| 215 | |
| 216 | $this->add_control( |
| 217 | 'btn_type', |
| 218 | [ |
| 219 | 'label' => __('Type', 'auxin-elements'), |
| 220 | 'type' => Controls_Manager::SELECT, |
| 221 | 'default' => 'default', |
| 222 | 'options' => [ |
| 223 | 'default' => __('Default', 'auxin-elements' ), |
| 224 | 'outline' => __('Outline' , 'auxin-elements' ), |
| 225 | ] |
| 226 | ] |
| 227 | ); |
| 228 | |
| 229 | $this->add_control( |
| 230 | 'btn_shape', |
| 231 | [ |
| 232 | 'label' => __('Shape', 'auxin-elements'), |
| 233 | 'type' => Controls_Manager::SELECT, |
| 234 | 'default' => 'normal', |
| 235 | 'options' => [ |
| 236 | 'normal' => __('Normal', 'auxin-elements' ), |
| 237 | 'round' => __('Round' , 'auxin-elements' ), |
| 238 | 'curve' => __('Curve' , 'auxin-elements' ), |
| 239 | ] |
| 240 | ] |
| 241 | ); |
| 242 | |
| 243 | $this->add_control( |
| 244 | 'btn_size', |
| 245 | [ |
| 246 | 'label' => __('Size', 'auxin-elements'), |
| 247 | 'type' => Controls_Manager::SELECT, |
| 248 | 'default' => 'md', |
| 249 | 'options' => [ |
| 250 | 'xl' => __('Exlarge', 'auxin-elements' ), |
| 251 | 'lg' => __('Large' , 'auxin-elements' ), |
| 252 | 'md' => __('Medium' , 'auxin-elements' ), |
| 253 | 'sm' => __('Small' , 'auxin-elements' ), |
| 254 | 'xs' => __('Tiny' , 'auxin-elements' ) |
| 255 | ] |
| 256 | ] |
| 257 | ); |
| 258 | |
| 259 | $this->add_control( |
| 260 | 'btn_skin', |
| 261 | [ |
| 262 | 'label' => __('Skin', 'auxin-elements'), |
| 263 | 'label_block' => false, |
| 264 | 'type' => 'aux-visual-select', |
| 265 | 'default' => 'black', |
| 266 | 'options' =>[ |
| 267 | 'black' => [ |
| 268 | 'label' => __('black', 'auxin-elements'), |
| 269 | 'css_class' => 'aux-color-selector aux-button aux-visual-selector-black' |
| 270 | ], |
| 271 | 'white' => [ |
| 272 | 'label' => __('White', 'auxin-elements'), |
| 273 | 'css_class' => 'aux-color-selector aux-button aux-visual-selector-white' |
| 274 | ], |
| 275 | 'info' => [ |
| 276 | 'label' => __('Ball Blue', 'auxin-elements'), |
| 277 | 'css_class' => 'aux-color-selector aux-button aux-visual-selector-ball-blue' |
| 278 | ], |
| 279 | 'warning' => [ |
| 280 | 'label' => __('Mikado Yellow', 'auxin-elements'), |
| 281 | 'css_class' => 'aux-color-selector aux-button aux-visual-selector-mikado-yellow' |
| 282 | ], |
| 283 | 'caution' => [ |
| 284 | 'label' => __('Carmine Pink', 'auxin-elements'), |
| 285 | 'css_class' => 'aux-color-selector aux-button aux-visual-selector-carmine-pink' |
| 286 | ] |
| 287 | ] |
| 288 | ] |
| 289 | ); |
| 290 | |
| 291 | $this->start_controls_tabs( 'btn_styles' ); |
| 292 | |
| 293 | $this->start_controls_tab( |
| 294 | 'btn_normal', |
| 295 | [ |
| 296 | 'label' => __( 'Normal' , 'auxin-elements' ) |
| 297 | ] |
| 298 | ); |
| 299 | |
| 300 | $this->add_group_control( |
| 301 | Group_Control_Background::get_type(), |
| 302 | [ |
| 303 | 'name' => 'btn_bg_normal', |
| 304 | 'label' => __( 'Background', 'auxin-elements' ), |
| 305 | 'types' => [ 'classic', 'gradient' ], |
| 306 | 'selector' => '{{WRAPPER}} .aux-modern-button.aux-modern-button-outline .aux-overlay:before, {{WRAPPER}} .aux-modern-button .aux-overlay:before' |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | $this->add_group_control( |
| 311 | Group_Control_Box_Shadow::get_type(), |
| 312 | [ |
| 313 | 'name' => 'btn_box_shadow_normal', |
| 314 | 'selector' => '{{WRAPPER}} .aux-overlay:before, {{WRAPPER}} .aux-overlay:after' |
| 315 | ] |
| 316 | ); |
| 317 | |
| 318 | $this->add_responsive_control( |
| 319 | 'btn_padding_normal', |
| 320 | [ |
| 321 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 322 | 'type' => Controls_Manager::DIMENSIONS, |
| 323 | 'size_units' => [ 'px', '%' ], |
| 324 | 'selectors' => [ |
| 325 | '{{WRAPPER}} .aux-modern-button' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 326 | ] |
| 327 | ] |
| 328 | ); |
| 329 | |
| 330 | $this->add_responsive_control( |
| 331 | 'btn_border_radius_normal', |
| 332 | [ |
| 333 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 334 | 'type' => Controls_Manager::DIMENSIONS, |
| 335 | 'size_units' => [ 'px', 'em', '%' ], |
| 336 | 'allowed_dimensions' => 'all', |
| 337 | 'separator' => 'before', |
| 338 | 'selectors' => [ |
| 339 | '{{WRAPPER}} .aux-overlay:before, {{WRAPPER}} .aux-overlay:after' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 340 | ] |
| 341 | ] |
| 342 | ); |
| 343 | |
| 344 | $this->end_controls_tab(); |
| 345 | |
| 346 | $this->start_controls_tab( |
| 347 | 'button_hover', |
| 348 | [ |
| 349 | 'label' => __( 'Hover' , 'auxin-elements' ) |
| 350 | ] |
| 351 | ); |
| 352 | |
| 353 | $this->add_group_control( |
| 354 | Group_Control_Background::get_type(), |
| 355 | [ |
| 356 | 'name' => 'btn_bg_hover', |
| 357 | 'label' => __( 'Background', 'auxin-elements' ), |
| 358 | 'types' => [ 'classic', 'gradient' ], |
| 359 | 'selector' => '{{WRAPPER}} .aux-modern-button.aux-modern-button-outline .aux-overlay:after, {{WRAPPER}} .aux-modern-button .aux-overlay:after' |
| 360 | ] |
| 361 | ); |
| 362 | |
| 363 | $this->add_group_control( |
| 364 | Group_Control_Box_Shadow::get_type(), |
| 365 | [ |
| 366 | 'name' => 'btn_box_shadow_hover', |
| 367 | 'selector' => '{{WRAPPER}} .aux-modern-button:hover .aux-overlay:before, {{WRAPPER}} .aux-modern-button:hover .aux-overlay:after' |
| 368 | ] |
| 369 | ); |
| 370 | |
| 371 | $this->add_responsive_control( |
| 372 | 'btn_padding_hover', |
| 373 | [ |
| 374 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 375 | 'type' => Controls_Manager::DIMENSIONS, |
| 376 | 'size_units' => [ 'px', '%' ], |
| 377 | 'selectors' => [ |
| 378 | '{{WRAPPER}} .aux-modern-button:hover' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 379 | ] |
| 380 | ] |
| 381 | ); |
| 382 | |
| 383 | $this->add_responsive_control( |
| 384 | 'btn_border_radius_hover', |
| 385 | [ |
| 386 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 387 | 'type' => Controls_Manager::DIMENSIONS, |
| 388 | 'size_units' => [ 'px', 'em', '%' ], |
| 389 | 'allowed_dimensions' => 'all', |
| 390 | 'separator' => 'before', |
| 391 | 'selectors' => [ |
| 392 | '{{WRAPPER}} .aux-modern-button:hover .aux-overlay:before, {{WRAPPER}} .aux-modern-button:hover .aux-overlay:after' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 393 | ] |
| 394 | ] |
| 395 | ); |
| 396 | |
| 397 | $this->end_controls_tab(); |
| 398 | |
| 399 | $this->end_controls_tabs(); |
| 400 | |
| 401 | $this->end_controls_section(); |
| 402 | |
| 403 | /*-----------------------------------------------------------------------------------*/ |
| 404 | /* Text Style Section |
| 405 | /*-----------------------------------------------------------------------------------*/ |
| 406 | |
| 407 | $this->start_controls_section( |
| 408 | 'section_style_text', |
| 409 | [ |
| 410 | 'label' => __('Text', 'auxin-elements' ), |
| 411 | 'tab' => Controls_Manager::TAB_STYLE |
| 412 | ] |
| 413 | ); |
| 414 | |
| 415 | |
| 416 | $this->start_controls_tabs( 'text_styles' ); |
| 417 | |
| 418 | $this->start_controls_tab( |
| 419 | 'text_normal', |
| 420 | [ |
| 421 | 'label' => __( 'Normal' , 'auxin-elements' ) |
| 422 | ] |
| 423 | ); |
| 424 | |
| 425 | $this->add_group_control( |
| 426 | Group_Control_Typography::get_type(), |
| 427 | [ |
| 428 | 'name' => 'text_normal_typo', |
| 429 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 430 | 'selector' => '{{WRAPPER}} .aux-text' |
| 431 | ] |
| 432 | ); |
| 433 | |
| 434 | $this->add_control( |
| 435 | 'text_normal_color', |
| 436 | [ |
| 437 | 'label' => __( 'Color', 'auxin-elements' ), |
| 438 | 'type' => Controls_Manager::COLOR, |
| 439 | 'selectors' => [ |
| 440 | '{{WRAPPER}} .aux-text' => 'color: {{VALUE}};' |
| 441 | ] |
| 442 | ] |
| 443 | |
| 444 | ); |
| 445 | |
| 446 | $this->add_group_control( |
| 447 | Group_Control_Text_Shadow::get_type(), |
| 448 | [ |
| 449 | 'name' => 'text_normal_text_shadow', |
| 450 | 'label' => __( 'Text Shadow', 'auxin-elements' ), |
| 451 | 'selector' => '{{WRAPPER}} .aux-text' |
| 452 | ] |
| 453 | ); |
| 454 | |
| 455 | $this->end_controls_tab(); |
| 456 | |
| 457 | $this->start_controls_tab( |
| 458 | 'text_hover', |
| 459 | [ |
| 460 | 'label' => __( 'Hover' , 'auxin-elements' ) |
| 461 | ] |
| 462 | ); |
| 463 | |
| 464 | $this->add_group_control( |
| 465 | Group_Control_Typography::get_type(), |
| 466 | [ |
| 467 | 'name' => 'text_hover_typo', |
| 468 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 469 | 'selector' => '{{WRAPPER}} .aux-modern-button:hover .aux-text' |
| 470 | ] |
| 471 | ); |
| 472 | |
| 473 | $this->add_control( |
| 474 | 'text_hover_color', |
| 475 | [ |
| 476 | 'label' => __( 'Color', 'auxin-elements' ), |
| 477 | 'type' => Controls_Manager::COLOR, |
| 478 | 'selectors' => [ |
| 479 | '{{WRAPPER}} .aux-modern-button:hover .aux-text' => 'color:{{VALUE}};' |
| 480 | ] |
| 481 | ] |
| 482 | ); |
| 483 | |
| 484 | $this->add_group_control( |
| 485 | Group_Control_Text_Shadow::get_type(), |
| 486 | [ |
| 487 | 'name' => 'text_hover_text_shadow', |
| 488 | 'label' => __( 'Text Shadow', 'auxin-elements' ), |
| 489 | 'selector' => '{{WRAPPER}} .aux-modern-button:hover .aux-text' |
| 490 | ] |
| 491 | ); |
| 492 | |
| 493 | $this->end_controls_tab(); |
| 494 | |
| 495 | $this->end_controls_tabs(); |
| 496 | |
| 497 | $this->end_controls_section(); |
| 498 | |
| 499 | /*-----------------------------------------------------------------------------------*/ |
| 500 | /* Button Style Section |
| 501 | /*-----------------------------------------------------------------------------------*/ |
| 502 | |
| 503 | $this->start_controls_section( |
| 504 | 'section_style_icon', |
| 505 | [ |
| 506 | 'label' => __('Icon', 'auxin-elements' ), |
| 507 | 'tab' => Controls_Manager::TAB_STYLE, |
| 508 | 'condition' => [ |
| 509 | 'icon_display' => 'yes' |
| 510 | ] |
| 511 | ] |
| 512 | ); |
| 513 | |
| 514 | $this->add_control( |
| 515 | 'icon_align', |
| 516 | [ |
| 517 | 'label' => __('Alignment', 'auxin-elements'), |
| 518 | 'type' => Controls_Manager::SELECT, |
| 519 | 'default' => 'left', |
| 520 | 'options' => [ |
| 521 | 'top' => __('Over', 'auxin-elements' ), |
| 522 | 'bottom' => __('Below', 'auxin-elements' ), |
| 523 | 'left' => __('Left', 'auxin-elements' ), |
| 524 | 'right' => __('Right', 'auxin-elements' ), |
| 525 | ] |
| 526 | ] |
| 527 | ); |
| 528 | |
| 529 | $this->start_controls_tabs( 'icon_styles' ); |
| 530 | |
| 531 | $this->start_controls_tab( |
| 532 | 'icon_normal', |
| 533 | [ |
| 534 | 'label' => __( 'Normal' , 'auxin-elements' ) |
| 535 | ] |
| 536 | ); |
| 537 | |
| 538 | $this->add_responsive_control( |
| 539 | 'icon_normal_size', |
| 540 | [ |
| 541 | 'label' => __( 'Size', 'auxin-elements' ), |
| 542 | 'type' => Controls_Manager::SLIDER, |
| 543 | 'size_units' => [ 'px', '%' ], |
| 544 | 'range' => [ |
| 545 | 'px' => [ |
| 546 | 'min' => 10, |
| 547 | 'max' => 512, |
| 548 | 'step' => 2, |
| 549 | ], |
| 550 | '%' => [ |
| 551 | 'min' => 0, |
| 552 | 'max' => 100, |
| 553 | ], |
| 554 | ], |
| 555 | 'selectors' => [ |
| 556 | '{{WRAPPER}} .aux-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 557 | ] |
| 558 | ] |
| 559 | ); |
| 560 | |
| 561 | $this->add_control( |
| 562 | 'icon_normal_color', |
| 563 | [ |
| 564 | 'label' => __( 'Color', 'auxin-elements' ), |
| 565 | 'type' => Controls_Manager::COLOR, |
| 566 | 'selectors' => [ |
| 567 | '{{WRAPPER}} .aux-icon' => 'color: {{VALUE}};', |
| 568 | ] |
| 569 | ] |
| 570 | ); |
| 571 | |
| 572 | $this->add_group_control( |
| 573 | Group_Control_Background::get_type(), |
| 574 | [ |
| 575 | 'name' => 'icon_normal_bg', |
| 576 | 'label' => __( 'Background', 'auxin-elements' ), |
| 577 | 'types' => [ 'classic', 'gradient' ], |
| 578 | 'selector' => '{{WRAPPER}} .aux-icon:before', |
| 579 | ] |
| 580 | ); |
| 581 | |
| 582 | $this->add_group_control( |
| 583 | Group_Control_Box_Shadow::get_type(), |
| 584 | [ |
| 585 | 'name' => 'icon_normal_box_shadow', |
| 586 | 'selector' => '{{WRAPPER}} .aux-icon' |
| 587 | ] |
| 588 | ); |
| 589 | |
| 590 | $this->add_responsive_control( |
| 591 | 'icon_normal_margin', |
| 592 | [ |
| 593 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 594 | 'type' => Controls_Manager::DIMENSIONS, |
| 595 | 'size_units' => [ 'px', '%' ], |
| 596 | 'selectors' => [ |
| 597 | '{{WRAPPER}} .aux-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 598 | ] |
| 599 | ] |
| 600 | ); |
| 601 | |
| 602 | $this->add_responsive_control( |
| 603 | 'icon_normal_padding', |
| 604 | [ |
| 605 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 606 | 'type' => Controls_Manager::DIMENSIONS, |
| 607 | 'size_units' => [ 'px', '%' ], |
| 608 | 'selectors' => [ |
| 609 | '{{WRAPPER}} .aux-icon' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 610 | ] |
| 611 | ] |
| 612 | ); |
| 613 | |
| 614 | $this->add_responsive_control( |
| 615 | 'icon_normal_border_radius', |
| 616 | [ |
| 617 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 618 | 'type' => Controls_Manager::DIMENSIONS, |
| 619 | 'size_units' => [ 'px', 'em', '%' ], |
| 620 | 'allowed_dimensions' => 'all', |
| 621 | 'separator' => 'before', |
| 622 | 'selectors' => [ |
| 623 | '{{WRAPPER}} .aux-icon' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 624 | ], |
| 625 | ] |
| 626 | ); |
| 627 | |
| 628 | $this->end_controls_tab(); |
| 629 | |
| 630 | $this->start_controls_tab( |
| 631 | 'icon_hover', |
| 632 | [ |
| 633 | 'label' => __( 'Hover' , 'auxin-elements' ) |
| 634 | ] |
| 635 | ); |
| 636 | |
| 637 | $this->add_responsive_control( |
| 638 | 'icon_hover_size', |
| 639 | [ |
| 640 | 'label' => __( 'Size', 'auxin-elements' ), |
| 641 | 'type' => Controls_Manager::SLIDER, |
| 642 | 'size_units' => [ 'px', '%' ], |
| 643 | 'range' => [ |
| 644 | 'px' => [ |
| 645 | 'min' => 10, |
| 646 | 'max' => 512, |
| 647 | 'step' => 2, |
| 648 | ], |
| 649 | '%' => [ |
| 650 | 'min' => 0, |
| 651 | 'max' => 100, |
| 652 | ], |
| 653 | ], |
| 654 | 'selectors' => [ |
| 655 | '{{WRAPPER}} .aux-modern-button:hover .aux-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 656 | ] |
| 657 | ] |
| 658 | ); |
| 659 | |
| 660 | $this->add_control( |
| 661 | 'icon_hover_color', |
| 662 | [ |
| 663 | 'label' => __( 'Color', 'auxin-elements' ), |
| 664 | 'type' => Controls_Manager::COLOR, |
| 665 | 'selectors' => [ |
| 666 | '{{WRAPPER}} .aux-modern-button:hover .aux-icon' => 'color: {{VALUE}};', |
| 667 | ] |
| 668 | ] |
| 669 | ); |
| 670 | |
| 671 | $this->add_group_control( |
| 672 | Group_Control_Background::get_type(), |
| 673 | [ |
| 674 | 'name' => 'icon_hover_bg', |
| 675 | 'label' => __( 'Background', 'auxin-elements' ), |
| 676 | 'types' => [ 'classic', 'gradient' ], |
| 677 | 'selector' => '{{WRAPPER}} .aux-icon:after', |
| 678 | ] |
| 679 | ); |
| 680 | |
| 681 | $this->add_group_control( |
| 682 | Group_Control_Box_Shadow::get_type(), |
| 683 | [ |
| 684 | 'name' => 'icon_hover_box_shadow', |
| 685 | 'selector' => '{{WRAPPER}} .aux-modern-button:hover .aux-button' |
| 686 | ] |
| 687 | ); |
| 688 | |
| 689 | $this->add_responsive_control( |
| 690 | 'icon_hover_margin', |
| 691 | [ |
| 692 | 'label' => __( 'Margin', 'auxin-elements' ), |
| 693 | 'type' => Controls_Manager::DIMENSIONS, |
| 694 | 'size_units' => [ 'px', '%' ], |
| 695 | 'selectors' => [ |
| 696 | '{{WRAPPER}} .aux-modern-button:hover .aux-icon' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 697 | ] |
| 698 | ] |
| 699 | ); |
| 700 | |
| 701 | $this->add_responsive_control( |
| 702 | 'icon_hover_padding', |
| 703 | [ |
| 704 | 'label' => __( 'Padding', 'auxin-elements' ), |
| 705 | 'type' => Controls_Manager::DIMENSIONS, |
| 706 | 'size_units' => [ 'px', '%' ], |
| 707 | 'selectors' => [ |
| 708 | '{{WRAPPER}} .aux-modern-button:hover .aux-icon' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 709 | ] |
| 710 | ] |
| 711 | ); |
| 712 | |
| 713 | $this->add_responsive_control( |
| 714 | 'icon_hover_border_radius', |
| 715 | [ |
| 716 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 717 | 'type' => Controls_Manager::DIMENSIONS, |
| 718 | 'size_units' => [ 'px', 'em', '%' ], |
| 719 | 'allowed_dimensions' => 'all', |
| 720 | 'separator' => 'before', |
| 721 | 'selectors' => [ |
| 722 | '{{WRAPPER}} .aux-icon:hover' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 723 | ], |
| 724 | ] |
| 725 | ); |
| 726 | |
| 727 | $this->end_controls_tab(); |
| 728 | |
| 729 | $this->end_controls_tabs(); |
| 730 | |
| 731 | $this->end_controls_section(); |
| 732 | } |
| 733 | |
| 734 | /** |
| 735 | * Render image box widget output on the frontend. |
| 736 | * |
| 737 | * Written in PHP and used to generate the final HTML. |
| 738 | * |
| 739 | * @since 1.0.0 |
| 740 | * @access protected |
| 741 | */ |
| 742 | protected function render() { |
| 743 | |
| 744 | $settings = $this->get_settings_for_display(); |
| 745 | |
| 746 | $this->add_render_attribute( 'wrapper', 'class', 'aux-modern-button-wrapper' ); |
| 747 | $this->add_render_attribute( 'wrapper', 'class', 'aux-modern-button-align-' . $settings['btn_align'] ); |
| 748 | |
| 749 | $this->add_render_attribute( 'button', 'class', 'aux-modern-button' ); |
| 750 | $this->add_render_attribute( 'button', 'class', 'aux-' . $settings['btn_skin'] ); |
| 751 | $this->add_render_attribute( 'button', 'class', 'aux-modern-button-' . $settings['btn_size'] ); |
| 752 | $this->add_render_attribute( 'button', 'class', 'aux-modern-button-' . $settings['btn_shape'] ); |
| 753 | $this->add_render_attribute( 'button', 'class', 'aux-modern-button-' . $settings['btn_type'] ); |
| 754 | $this->add_render_attribute( 'button', 'class', 'aux-icon-' . $settings['icon_align'] ); |
| 755 | |
| 756 | if ( ! empty( $settings['link']['url'] ) ) { |
| 757 | $this->add_link_attributes( 'button', $settings['link'] ); |
| 758 | } |
| 759 | |
| 760 | ?> |
| 761 | <div <?php echo $this->get_render_attribute_string( 'wrapper' ); ?> > |
| 762 | <?php |
| 763 | if ( auxin_is_true( $settings['open_video_in_lightbox'] ) ) { |
| 764 | |
| 765 | $this->add_render_attribute( 'button', 'class', 'aux-open-video' ); |
| 766 | $this->add_render_attribute( 'button', 'data-type', 'video' ); |
| 767 | |
| 768 | echo '<span class="aux-lightbox-video ">'; |
| 769 | } |
| 770 | ?> |
| 771 | <a <?php echo $this->get_render_attribute_string( 'button' ); ?>> |
| 772 | <div class="aux-overlay"></div> |
| 773 | <?php if ( $settings['icon_display'] ) { ;?> |
| 774 | <div class="aux-icon "> |
| 775 | <?php Icons_Manager::render_icon( $settings['icon'], [ 'aria-hidden' => 'true' ] );?> |
| 776 | </div> |
| 777 | <?php };?> |
| 778 | <div class="aux-text"><?php echo esc_html( $settings['label'] ); ?></div> |
| 779 | </a> |
| 780 | <?php |
| 781 | if ( auxin_is_true( $settings['open_video_in_lightbox'] ) ) { |
| 782 | echo '</span>'; |
| 783 | } |
| 784 | ?> |
| 785 | |
| 786 | </div> |
| 787 | |
| 788 | <?php |
| 789 | } |
| 790 | |
| 791 | } |