dep
5 years ago
premium-banner.php
5 years ago
premium-blog.php
5 years ago
premium-button.php
5 years ago
premium-carousel.php
5 years ago
premium-contactform.php
5 years ago
premium-countdown.php
5 years ago
premium-counter.php
5 years ago
premium-dual-header.php
5 years ago
premium-fancytext.php
5 years ago
premium-grid.php
5 years ago
premium-icon-list.php
5 years ago
premium-image-button.php
5 years ago
premium-image-scroll.php
5 years ago
premium-image-separator.php
5 years ago
premium-lottie.php
5 years ago
premium-maps.php
5 years ago
premium-modalbox.php
5 years ago
premium-person.php
5 years ago
premium-pricing-table.php
5 years ago
premium-progressbar.php
5 years ago
premium-testimonials.php
5 years ago
premium-title.php
5 years ago
premium-videobox.php
5 years ago
premium-vscroll.php
5 years ago
premium-modalbox.php
1800 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Premium Modal Box. |
| 5 | */ |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Icons_Manager; |
| 10 | use Elementor\Widget_Base; |
| 11 | use Elementor\Utils; |
| 12 | use Elementor\Control_Media; |
| 13 | use Elementor\Controls_Manager; |
| 14 | use Elementor\Scheme_Color; |
| 15 | use Elementor\Scheme_Typography; |
| 16 | use Elementor\Group_Control_Border; |
| 17 | use Elementor\Group_Control_Css_Filter; |
| 18 | use Elementor\Group_Control_Typography; |
| 19 | use Elementor\Group_Control_Text_Shadow; |
| 20 | use Elementor\Group_Control_Box_Shadow; |
| 21 | use Elementor\Group_Control_Background; |
| 22 | |
| 23 | // PremiumAddons Classes. |
| 24 | use PremiumAddons\Includes\Helper_Functions; |
| 25 | use PremiumAddons\Includes\Premium_Template_Tags; |
| 26 | |
| 27 | if (!defined('ABSPATH')) exit; // If this file is called directly, abort. |
| 28 | |
| 29 | /** |
| 30 | * Class Premium_Modalbox |
| 31 | */ |
| 32 | class Premium_Modalbox extends Widget_Base |
| 33 | { |
| 34 | |
| 35 | public function getTemplateInstance() |
| 36 | { |
| 37 | return $this->templateInstance = Premium_Template_Tags::getInstance(); |
| 38 | } |
| 39 | |
| 40 | public function get_name() |
| 41 | { |
| 42 | return 'premium-addon-modal-box'; |
| 43 | } |
| 44 | |
| 45 | public function check_rtl() |
| 46 | { |
| 47 | return is_rtl(); |
| 48 | } |
| 49 | |
| 50 | public function get_title() |
| 51 | { |
| 52 | return sprintf('%1$s %2$s', Helper_Functions::get_prefix(), __('Modal Box', 'premium-addons-for-elementor')); |
| 53 | } |
| 54 | |
| 55 | public function get_icon() |
| 56 | { |
| 57 | return 'pa-modal-box'; |
| 58 | } |
| 59 | |
| 60 | public function get_style_depends() |
| 61 | { |
| 62 | return [ |
| 63 | 'premium-addons' |
| 64 | ]; |
| 65 | } |
| 66 | |
| 67 | public function get_script_depends() |
| 68 | { |
| 69 | return [ |
| 70 | 'modal-js', |
| 71 | 'lottie-js', |
| 72 | 'premium-addons', |
| 73 | ]; |
| 74 | } |
| 75 | |
| 76 | public function get_categories() |
| 77 | { |
| 78 | return ['premium-elements']; |
| 79 | } |
| 80 | |
| 81 | public function get_custom_help_url() |
| 82 | { |
| 83 | return 'https://premiumaddons.com/support/'; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Register Modal Box controls. |
| 88 | * |
| 89 | * @since 1.0.0 |
| 90 | * @access protected |
| 91 | */ |
| 92 | protected function _register_controls() |
| 93 | { |
| 94 | |
| 95 | $this->start_controls_section( |
| 96 | 'premium_modal_box_selector_content_section', |
| 97 | [ |
| 98 | 'label' => __('Content', 'premium-addons-for-elementor'), |
| 99 | ] |
| 100 | ); |
| 101 | |
| 102 | $this->add_control( |
| 103 | 'premium_modal_box_header_switcher', |
| 104 | [ |
| 105 | 'label' => __('Header', 'premium-addons-for-elementor'), |
| 106 | 'type' => Controls_Manager::SWITCHER, |
| 107 | 'label_on' => 'show', |
| 108 | 'label_off' => 'hide', |
| 109 | 'default' => 'yes', |
| 110 | 'description' => __('Enable or disable modal header', 'premium-addons-for-elementor'), |
| 111 | ] |
| 112 | ); |
| 113 | |
| 114 | $this->add_control( |
| 115 | 'premium_modal_box_icon_selection', |
| 116 | [ |
| 117 | 'label' => __('Icon Type', 'premium-addons-for-elementor'), |
| 118 | 'type' => Controls_Manager::SELECT, |
| 119 | 'options' => [ |
| 120 | 'noicon' => __('None', 'premium-addons-for-elementor'), |
| 121 | 'fonticon' => __('Icon', 'premium-addons-for-elementor'), |
| 122 | 'image' => __('Custom Image', 'premium-addons-for-elementor'), |
| 123 | 'animation' => __('Lottie Animation', 'premium-addons-for-elementor'), |
| 124 | ], |
| 125 | 'default' => 'noicon', |
| 126 | 'condition' => [ |
| 127 | 'premium_modal_box_header_switcher' => 'yes' |
| 128 | ], |
| 129 | 'label_block' => true |
| 130 | ] |
| 131 | ); |
| 132 | |
| 133 | $this->add_control( |
| 134 | 'premium_modal_box_font_icon_updated', |
| 135 | [ |
| 136 | 'label' => __('Select Icon', 'premium-addons-for-elementor'), |
| 137 | 'type' => Controls_Manager::ICONS, |
| 138 | 'fa4compatibility' => 'premium_modal_box_font_icon', |
| 139 | 'condition' => [ |
| 140 | 'premium_modal_box_icon_selection' => 'fonticon', |
| 141 | 'premium_modal_box_header_switcher' => 'yes' |
| 142 | ], |
| 143 | 'label_block' => true, |
| 144 | ] |
| 145 | ); |
| 146 | |
| 147 | $this->add_control( |
| 148 | 'premium_modal_box_image_icon', |
| 149 | [ |
| 150 | 'label' => __('Upload Image', 'premium-addons-for-elementor'), |
| 151 | 'type' => Controls_Manager::MEDIA, |
| 152 | 'dynamic' => ['active' => true], |
| 153 | 'default' => [ |
| 154 | 'url' => Utils::get_placeholder_image_src(), |
| 155 | ], |
| 156 | 'condition' => [ |
| 157 | 'premium_modal_box_icon_selection' => 'image', |
| 158 | 'premium_modal_box_header_switcher' => 'yes' |
| 159 | ], |
| 160 | 'label_block' => true, |
| 161 | ] |
| 162 | ); |
| 163 | |
| 164 | $this->add_control( |
| 165 | 'header_lottie_url', |
| 166 | [ |
| 167 | 'label' => __('Animation JSON URL', 'premium-addons-for-elementor'), |
| 168 | 'type' => Controls_Manager::TEXT, |
| 169 | 'dynamic' => ['active' => true], |
| 170 | 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>', |
| 171 | 'label_block' => true, |
| 172 | 'condition' => [ |
| 173 | 'premium_modal_box_icon_selection' => 'animation', |
| 174 | 'premium_modal_box_header_switcher' => 'yes' |
| 175 | ] |
| 176 | ] |
| 177 | ); |
| 178 | |
| 179 | $this->add_control( |
| 180 | 'header_lottie_loop', |
| 181 | [ |
| 182 | 'label' => __('Loop', 'premium-addons-for-elementor'), |
| 183 | 'type' => Controls_Manager::SWITCHER, |
| 184 | 'return_value' => 'true', |
| 185 | 'default' => 'true', |
| 186 | 'condition' => [ |
| 187 | 'premium_modal_box_icon_selection' => 'animation', |
| 188 | 'premium_modal_box_header_switcher' => 'yes' |
| 189 | ] |
| 190 | ] |
| 191 | ); |
| 192 | |
| 193 | $this->add_control( |
| 194 | 'header_lottie_reverse', |
| 195 | [ |
| 196 | 'label' => __('Reverse', 'premium-addons-for-elementor'), |
| 197 | 'type' => Controls_Manager::SWITCHER, |
| 198 | 'return_value' => 'true', |
| 199 | 'condition' => [ |
| 200 | 'premium_modal_box_icon_selection' => 'animation', |
| 201 | 'premium_modal_box_header_switcher' => 'yes' |
| 202 | ] |
| 203 | ] |
| 204 | ); |
| 205 | |
| 206 | $this->add_responsive_control( |
| 207 | 'premium_modal_box_font_icon_size', |
| 208 | [ |
| 209 | 'label' => __('Icon Size', 'premium-addons-for-elementor'), |
| 210 | 'type' => Controls_Manager::SLIDER, |
| 211 | 'size_units' => ['px', 'em'], |
| 212 | 'selectors' => [ |
| 213 | '{{WRAPPER}} .premium-modal-box-modal-title i' => 'font-size: {{SIZE}}{{UNIT}}', |
| 214 | '{{WRAPPER}} .premium-modal-box-modal-title img' => 'width: {{SIZE}}{{UNIT}}', |
| 215 | '{{WRAPPER}} .premium-modal-box-modal-title svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}', |
| 216 | ], |
| 217 | 'condition' => [ |
| 218 | 'premium_modal_box_icon_selection!' => 'noicon', |
| 219 | 'premium_modal_box_header_switcher' => 'yes' |
| 220 | ], |
| 221 | ] |
| 222 | ); |
| 223 | |
| 224 | $this->add_control( |
| 225 | 'premium_modal_box_title', |
| 226 | [ |
| 227 | 'label' => __('Title', 'premium-addons-for-elementor'), |
| 228 | 'type' => Controls_Manager::TEXT, |
| 229 | 'dynamic' => ['active' => true], |
| 230 | 'description' => __('Add a title for the modal box', 'premium-addons-for-elementor'), |
| 231 | 'default' => 'Modal Box Title', |
| 232 | 'condition' => [ |
| 233 | 'premium_modal_box_header_switcher' => 'yes' |
| 234 | ], |
| 235 | 'label_block' => true, |
| 236 | ] |
| 237 | ); |
| 238 | |
| 239 | $this->add_control( |
| 240 | 'premium_modal_box_content_heading', |
| 241 | [ |
| 242 | 'label' => __('Content', 'premium-addons-for-elementor'), |
| 243 | 'type' => Controls_Manager::HEADING, |
| 244 | ] |
| 245 | ); |
| 246 | |
| 247 | $this->add_control( |
| 248 | 'premium_modal_box_content_type', |
| 249 | [ |
| 250 | 'label' => __('Content to Show', 'premium-addons-for-elementor'), |
| 251 | 'type' => Controls_Manager::SELECT, |
| 252 | 'options' => [ |
| 253 | 'editor' => __('Text Editor', 'premium-addons-for-elementor'), |
| 254 | 'template' => __('Elementor Template', 'premium-addons-for-elementor'), |
| 255 | ], |
| 256 | 'default' => 'editor', |
| 257 | 'label_block' => true |
| 258 | ] |
| 259 | ); |
| 260 | |
| 261 | $this->add_control( |
| 262 | 'premium_modal_box_content_temp', |
| 263 | [ |
| 264 | 'label' => __('Content', 'premium-addons-for-elementor'), |
| 265 | 'description' => __('Modal content is a template which you can choose from Elementor library', 'premium-addons-for-elementor'), |
| 266 | 'type' => Controls_Manager::SELECT2, |
| 267 | 'label_block' => true, |
| 268 | 'options' => $this->getTemplateInstance()->get_elementor_page_list(), |
| 269 | 'condition' => [ |
| 270 | 'premium_modal_box_content_type' => 'template', |
| 271 | ], |
| 272 | ] |
| 273 | ); |
| 274 | |
| 275 | $this->add_control( |
| 276 | 'premium_modal_box_content', |
| 277 | [ |
| 278 | 'type' => Controls_Manager::WYSIWYG, |
| 279 | 'default' => 'Modal Box Content', |
| 280 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-body', |
| 281 | 'dynamic' => ['active' => true], |
| 282 | 'condition' => [ |
| 283 | 'premium_modal_box_content_type' => 'editor', |
| 284 | ], |
| 285 | 'show_label' => false, |
| 286 | ] |
| 287 | ); |
| 288 | |
| 289 | $this->add_control( |
| 290 | 'premium_modal_box_upper_close', |
| 291 | [ |
| 292 | 'label' => __('Upper Close Button', 'premium-addons-for-elementor'), |
| 293 | 'type' => Controls_Manager::SWITCHER, |
| 294 | 'default' => 'yes', |
| 295 | 'condition' => [ |
| 296 | 'premium_modal_box_header_switcher' => 'yes' |
| 297 | ] |
| 298 | ] |
| 299 | ); |
| 300 | |
| 301 | $this->add_control( |
| 302 | 'premium_modal_box_lower_close', |
| 303 | [ |
| 304 | 'label' => __('Lower Close Button', 'premium-addons-for-elementor'), |
| 305 | 'type' => Controls_Manager::SWITCHER, |
| 306 | 'default' => 'yes', |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | $this->add_control( |
| 311 | 'premium_modal_close_text', |
| 312 | [ |
| 313 | 'label' => __('Text', 'premium-addons-for-elementor'), |
| 314 | 'default' => __('Close', 'premium-addons-for-elementor'), |
| 315 | 'type' => Controls_Manager::TEXT, |
| 316 | 'dynamic' => ['active' => true], |
| 317 | 'label_block' => true, |
| 318 | 'condition' => [ |
| 319 | 'premium_modal_box_lower_close' => 'yes' |
| 320 | ], |
| 321 | ] |
| 322 | ); |
| 323 | |
| 324 | $this->add_control('premium_modal_box_animation', |
| 325 | [ |
| 326 | 'label' => __( 'Entrance Animation', 'premium-addons-for-elementor' ), |
| 327 | 'type' => Controls_Manager::ANIMATION, |
| 328 | 'default' => 'fadeInDown', |
| 329 | 'label_block' => true, |
| 330 | 'frontend_available' => true, |
| 331 | 'render_type' => 'template', |
| 332 | |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | $this->add_control('premium_modal_box_animation_duration', |
| 337 | [ |
| 338 | 'label' => __( 'Animation Duration', 'premium-addons-for-elementor' ), |
| 339 | 'type' => Controls_Manager::SELECT, |
| 340 | 'default' => 'fast', |
| 341 | 'options' => [ |
| 342 | 'slow' => __( 'Slow', 'premium-addons-for-elementor' ), |
| 343 | '' => __( 'Normal', 'premium-addons-for-elementor' ), |
| 344 | 'fast' => __( 'Fast', 'premium-addons-for-elementor' ), |
| 345 | ], |
| 346 | 'condition' => [ |
| 347 | 'premium_modal_box_animation!' => '', |
| 348 | ], |
| 349 | ] |
| 350 | ); |
| 351 | |
| 352 | $this->add_control('premium_modal_box_animation_delay', |
| 353 | [ |
| 354 | 'label' => __( 'Animation Delay', 'premium-addons-for-elementor' ) . ' (s)', |
| 355 | 'type' => Controls_Manager::NUMBER, |
| 356 | 'default' => '', |
| 357 | 'step' => 0.1, |
| 358 | 'condition' => [ |
| 359 | 'premium_modal_box_animation!' => '', |
| 360 | ], |
| 361 | 'frontend_available' => true, |
| 362 | ] |
| 363 | ); |
| 364 | |
| 365 | $this->end_controls_section(); |
| 366 | |
| 367 | $this->start_controls_section( |
| 368 | 'premium_modal_box_content_section', |
| 369 | [ |
| 370 | 'label' => __('Trigger Options', 'premium-addons-for-elementor'), |
| 371 | ] |
| 372 | ); |
| 373 | |
| 374 | $this->add_control( |
| 375 | 'premium_modal_box_display_on', |
| 376 | [ |
| 377 | 'label' => __('Trigger', 'premium-addons-for-elementor'), |
| 378 | 'type' => Controls_Manager::SELECT, |
| 379 | 'description' => __('Choose where would you like the modal box appear on', 'premium-addons-for-elementor'), |
| 380 | 'options' => [ |
| 381 | 'button' => __('Button', 'premium-addons-for-elementor'), |
| 382 | 'image' => __('Image', 'premium-addons-for-elementor'), |
| 383 | 'text' => __('Text', 'premium-addons-for-elementor'), |
| 384 | 'animation' => __('Lottie Animation', 'premium-addons-for-elementor'), |
| 385 | 'pageload' => __('On Page Load', 'premium-addons-for-elementor'), |
| 386 | ], |
| 387 | 'label_block' => true, |
| 388 | 'default' => 'button', |
| 389 | ] |
| 390 | ); |
| 391 | |
| 392 | $this->add_control( |
| 393 | 'premium_modal_box_button_text', |
| 394 | [ |
| 395 | 'label' => __('Button Text', 'premium-addons-for-elementor'), |
| 396 | 'default' => __('Premium Modal Box', 'premium-addons-for-elementor'), |
| 397 | 'type' => Controls_Manager::TEXT, |
| 398 | 'dynamic' => ['active' => true], |
| 399 | 'label_block' => true, |
| 400 | 'condition' => [ |
| 401 | 'premium_modal_box_display_on' => 'button' |
| 402 | ], |
| 403 | ] |
| 404 | ); |
| 405 | |
| 406 | $this->add_control( |
| 407 | 'premium_modal_box_icon_switcher', |
| 408 | [ |
| 409 | 'label' => __('Icon', 'premium-addons-for-elementor'), |
| 410 | 'type' => Controls_Manager::SWITCHER, |
| 411 | 'condition' => [ |
| 412 | 'premium_modal_box_display_on' => 'button' |
| 413 | ], |
| 414 | 'description' => __('Enable or disable button icon', 'premium-addons-for-elementor'), |
| 415 | ] |
| 416 | ); |
| 417 | |
| 418 | $this->add_control( |
| 419 | 'premium_modal_box_button_icon_selection_updated', |
| 420 | [ |
| 421 | 'label' => __('Icon', 'premium-addons-for-elementor'), |
| 422 | 'type' => Controls_Manager::ICONS, |
| 423 | 'fa4compatibility' => 'premium_modal_box_button_icon_selection', |
| 424 | 'default' => [ |
| 425 | 'value' => 'fas fa-bars', |
| 426 | 'library' => 'fa-solid', |
| 427 | ], |
| 428 | 'label_block' => true, |
| 429 | 'condition' => [ |
| 430 | 'premium_modal_box_display_on' => 'button', |
| 431 | 'premium_modal_box_icon_switcher' => 'yes' |
| 432 | ], |
| 433 | ] |
| 434 | ); |
| 435 | |
| 436 | $this->add_control( |
| 437 | 'premium_modal_box_icon_position', |
| 438 | [ |
| 439 | 'label' => __('Icon Position', 'premium-addons-for-elementor'), |
| 440 | 'type' => Controls_Manager::SELECT, |
| 441 | 'default' => 'before', |
| 442 | 'options' => [ |
| 443 | 'before' => __('Before', 'premium-addons-for-elementor'), |
| 444 | 'after' => __('After', 'premium-addons-for-elementor'), |
| 445 | ], |
| 446 | 'label_block' => true, |
| 447 | 'condition' => [ |
| 448 | 'premium_modal_box_display_on' => 'button', |
| 449 | 'premium_modal_box_icon_switcher' => 'yes' |
| 450 | ], |
| 451 | ] |
| 452 | ); |
| 453 | |
| 454 | $this->add_control( |
| 455 | 'premium_modal_box_icon_before_size', |
| 456 | [ |
| 457 | 'label' => __('Icon Size', 'premium-addons-for-elementor'), |
| 458 | 'type' => Controls_Manager::SLIDER, |
| 459 | 'selectors' => [ |
| 460 | '{{WRAPPER}} .premium-modal-trigger-btn i' => 'font-size: {{SIZE}}px', |
| 461 | '{{WRAPPER}} .premium-modal-trigger-btn svg' => 'width: {{SIZE}}px; height: {{SIZE}}px', |
| 462 | ], |
| 463 | 'condition' => [ |
| 464 | 'premium_modal_box_display_on' => 'button', |
| 465 | 'premium_modal_box_icon_switcher' => 'yes' |
| 466 | ], |
| 467 | ] |
| 468 | ); |
| 469 | |
| 470 | if (!$this->check_rtl()) { |
| 471 | $this->add_control( |
| 472 | 'premium_modal_box_icon_before_spacing', |
| 473 | [ |
| 474 | 'label' => __('Icon Spacing', 'premium-addons-for-elementor'), |
| 475 | 'type' => Controls_Manager::SLIDER, |
| 476 | 'condition' => [ |
| 477 | 'premium_modal_box_display_on' => 'button', |
| 478 | 'premium_modal_box_icon_switcher' => 'yes', |
| 479 | 'premium_modal_box_icon_position' => 'before' |
| 480 | ], |
| 481 | 'default' => [ |
| 482 | 'size' => 15 |
| 483 | ], |
| 484 | 'selectors' => [ |
| 485 | '{{WRAPPER}} .premium-modal-trigger-btn i' => 'margin-right: {{SIZE}}px', |
| 486 | ], |
| 487 | 'separator' => 'after', |
| 488 | ] |
| 489 | ); |
| 490 | |
| 491 | $this->add_control( |
| 492 | 'premium_modal_box_icon_after_spacing', |
| 493 | [ |
| 494 | 'label' => __('Icon Spacing', 'premium-addons-for-elementor'), |
| 495 | 'type' => Controls_Manager::SLIDER, |
| 496 | 'default' => [ |
| 497 | 'size' => 15 |
| 498 | ], |
| 499 | 'selectors' => [ |
| 500 | '{{WRAPPER}} .premium-modal-trigger-btn i' => 'margin-left: {{SIZE}}px', |
| 501 | ], |
| 502 | 'separator' => 'after', |
| 503 | 'condition' => [ |
| 504 | 'premium_modal_box_display_on' => 'button', |
| 505 | 'premium_modal_box_icon_switcher' => 'yes', |
| 506 | 'premium_modal_box_icon_position' => 'after' |
| 507 | ], |
| 508 | ] |
| 509 | ); |
| 510 | } |
| 511 | |
| 512 | if ($this->check_rtl()) { |
| 513 | $this->add_control( |
| 514 | 'premium_modal_box_icon_rtl_before_spacing', |
| 515 | [ |
| 516 | 'label' => __('Icon Spacing', 'premium-addons-for-elementor'), |
| 517 | 'type' => Controls_Manager::SLIDER, |
| 518 | 'condition' => [ |
| 519 | 'premium_modal_box_display_on' => 'button', |
| 520 | 'premium_modal_box_icon_switcher' => 'yes', |
| 521 | 'premium_modal_box_icon_position' => 'before' |
| 522 | ], |
| 523 | 'default' => [ |
| 524 | 'size' => 15 |
| 525 | ], |
| 526 | 'selectors' => [ |
| 527 | '{{WRAPPER}} .premium-modal-trigger-btn i' => 'margin-left: {{SIZE}}px', |
| 528 | ], |
| 529 | 'separator' => 'after', |
| 530 | ] |
| 531 | ); |
| 532 | |
| 533 | $this->add_control( |
| 534 | 'premium_modal_box_icon_rtl_after_spacing', |
| 535 | [ |
| 536 | 'label' => __('Icon Spacing', 'premium-addons-for-elementor'), |
| 537 | 'type' => Controls_Manager::SLIDER, |
| 538 | 'default' => [ |
| 539 | 'size' => 15 |
| 540 | ], |
| 541 | 'selectors' => [ |
| 542 | '{{WRAPPER}} .premium-modal-trigger-btn i' => 'margin-right: {{SIZE}}px', |
| 543 | ], |
| 544 | 'separator' => 'after', |
| 545 | 'condition' => [ |
| 546 | 'premium_modal_box_display_on' => 'button', |
| 547 | 'premium_modal_box_icon_switcher' => 'yes', |
| 548 | 'premium_modal_box_icon_position' => 'after' |
| 549 | ], |
| 550 | ] |
| 551 | ); |
| 552 | } |
| 553 | |
| 554 | $this->add_control( |
| 555 | 'premium_modal_box_button_size', |
| 556 | [ |
| 557 | 'label' => __('Button Size', 'premium-addons-for-elementor'), |
| 558 | 'type' => Controls_Manager::SELECT, |
| 559 | 'options' => [ |
| 560 | 'sm' => __('Small', 'premium-addons-for-elementor'), |
| 561 | 'md' => __('Medium', 'premium-addons-for-elementor'), |
| 562 | 'lg' => __('Large', 'premium-addons-for-elementor'), |
| 563 | 'block' => __('Block', 'premium-addons-for-elementor'), |
| 564 | ], |
| 565 | 'label_block' => true, |
| 566 | 'default' => 'lg', |
| 567 | 'condition' => [ |
| 568 | 'premium_modal_box_display_on' => 'button' |
| 569 | ], |
| 570 | ] |
| 571 | ); |
| 572 | |
| 573 | $this->add_control( |
| 574 | 'premium_modal_box_image_src', |
| 575 | [ |
| 576 | 'label' => __('Image', 'premium-addons-for-elementor'), |
| 577 | 'type' => Controls_Manager::MEDIA, |
| 578 | 'dynamic' => ['active' => true], |
| 579 | 'default' => [ |
| 580 | 'url' => Utils::get_placeholder_image_src(), |
| 581 | ], |
| 582 | 'label_block' => true, |
| 583 | 'condition' => [ |
| 584 | 'premium_modal_box_display_on' => 'image', |
| 585 | ], |
| 586 | ] |
| 587 | ); |
| 588 | |
| 589 | $this->add_control( |
| 590 | 'premium_modal_box_selector_text', |
| 591 | [ |
| 592 | 'label' => __('Text', 'premium-addons-for-elementor'), |
| 593 | 'type' => Controls_Manager::TEXT, |
| 594 | 'dynamic' => ['active' => true], |
| 595 | 'label_block' => true, |
| 596 | 'default' => __('Premium Modal Box', 'premium-addons-for-elementor'), |
| 597 | 'condition' => [ |
| 598 | 'premium_modal_box_display_on' => 'text', |
| 599 | ] |
| 600 | ] |
| 601 | ); |
| 602 | |
| 603 | $this->add_control( |
| 604 | 'lottie_url', |
| 605 | [ |
| 606 | 'label' => __('Animation JSON URL', 'premium-addons-for-elementor'), |
| 607 | 'type' => Controls_Manager::TEXT, |
| 608 | 'dynamic' => ['active' => true], |
| 609 | 'description' => 'Get JSON code URL from <a href="https://lottiefiles.com/" target="_blank">here</a>', |
| 610 | 'label_block' => true, |
| 611 | 'condition' => [ |
| 612 | 'premium_modal_box_display_on' => 'animation', |
| 613 | ] |
| 614 | ] |
| 615 | ); |
| 616 | |
| 617 | $this->add_control( |
| 618 | 'lottie_loop', |
| 619 | [ |
| 620 | 'label' => __('Loop', 'premium-addons-for-elementor'), |
| 621 | 'type' => Controls_Manager::SWITCHER, |
| 622 | 'return_value' => 'true', |
| 623 | 'default' => 'true', |
| 624 | 'condition' => [ |
| 625 | 'premium_modal_box_display_on' => 'animation', |
| 626 | ] |
| 627 | ] |
| 628 | ); |
| 629 | |
| 630 | $this->add_control( |
| 631 | 'lottie_reverse', |
| 632 | [ |
| 633 | 'label' => __('Reverse', 'premium-addons-for-elementor'), |
| 634 | 'type' => Controls_Manager::SWITCHER, |
| 635 | 'return_value' => 'true', |
| 636 | 'condition' => [ |
| 637 | 'premium_modal_box_display_on' => 'animation', |
| 638 | ] |
| 639 | ] |
| 640 | ); |
| 641 | |
| 642 | $this->add_control( |
| 643 | 'lottie_hover', |
| 644 | [ |
| 645 | 'label' => __('Only Play on Hover', 'premium-addons-for-elementor'), |
| 646 | 'type' => Controls_Manager::SWITCHER, |
| 647 | 'return_value' => 'true', |
| 648 | 'condition' => [ |
| 649 | 'premium_modal_box_display_on' => 'animation', |
| 650 | ], |
| 651 | ] |
| 652 | ); |
| 653 | |
| 654 | $this->add_responsive_control('trigger_image_animation_size', |
| 655 | [ |
| 656 | 'label' => __('Size', 'premium-addons-for-elementor'), |
| 657 | 'type' => Controls_Manager::SLIDER, |
| 658 | 'size_units' => ['px', 'em', '%'], |
| 659 | 'range' => [ |
| 660 | 'px' => [ |
| 661 | 'min' => 1, |
| 662 | 'max' => 800, |
| 663 | ], |
| 664 | 'em' => [ |
| 665 | 'min' => 1, |
| 666 | 'max' => 30, |
| 667 | ], |
| 668 | ], |
| 669 | 'selectors' => [ |
| 670 | '{{WRAPPER}} .premium-modal-trigger-img, {{WRAPPER}} .premium-modal-trigger-animation' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}' |
| 671 | ], |
| 672 | 'condition' => [ |
| 673 | 'premium_modal_box_display_on' => ['image', 'animation'], |
| 674 | ], |
| 675 | ] |
| 676 | ); |
| 677 | |
| 678 | $this->add_control( |
| 679 | 'premium_modal_box_popup_delay', |
| 680 | [ |
| 681 | 'label' => __('Delay in Popup Display (Sec)', 'premium-addons-for-elementor'), |
| 682 | 'type' => Controls_Manager::NUMBER, |
| 683 | 'description' => __('When should the popup appear during page load? The value are counted in seconds', 'premium-addons-for-elementor'), |
| 684 | 'default' => 1, |
| 685 | 'label_block' => true, |
| 686 | 'condition' => [ |
| 687 | 'premium_modal_box_display_on' => 'pageload', |
| 688 | ] |
| 689 | ] |
| 690 | ); |
| 691 | |
| 692 | $this->add_responsive_control( |
| 693 | 'premium_modal_box_selector_align', |
| 694 | [ |
| 695 | 'label' => __('Alignment', 'premium-addons-for-elementor'), |
| 696 | 'type' => Controls_Manager::CHOOSE, |
| 697 | 'options' => [ |
| 698 | 'left' => [ |
| 699 | 'title' => __('Left', 'premium-addons-for-elementor'), |
| 700 | 'icon' => 'fa fa-align-left', |
| 701 | ], |
| 702 | 'center' => [ |
| 703 | 'title' => __('Center', 'premium-addons-for-elementor'), |
| 704 | 'icon' => 'fa fa-align-center', |
| 705 | ], |
| 706 | 'right' => [ |
| 707 | 'title' => __('Right', 'premium-addons-for-elementor'), |
| 708 | 'icon' => 'fa fa-align-right', |
| 709 | ], |
| 710 | ], |
| 711 | 'default' => 'center', |
| 712 | 'selectors' => [ |
| 713 | '{{WRAPPER}} .premium-modal-trigger-container' => 'text-align: {{VALUE}};', |
| 714 | ], |
| 715 | 'condition' => [ |
| 716 | 'premium_modal_box_display_on!' => 'pageload', |
| 717 | ], |
| 718 | ] |
| 719 | ); |
| 720 | |
| 721 | $this->end_controls_section(); |
| 722 | |
| 723 | $this->start_controls_section('section_pa_docs', |
| 724 | [ |
| 725 | 'label' => __('Helpful Documentations', 'premium-addons-for-elementor'), |
| 726 | ] |
| 727 | ); |
| 728 | |
| 729 | $docs = [ |
| 730 | 'https://premiumaddons.com/docs/modal-box-widget-tutorial/' => 'Getting started »', |
| 731 | 'https://premiumaddons.com/docs/how-can-i-insert-a-video-box-inside-premium-modal-box-widget/' => 'How Can I Insert a Video Box inside Premium Modal Box Widget »', |
| 732 | ]; |
| 733 | |
| 734 | $doc_index = 1; |
| 735 | foreach( $docs as $url => $title ) { |
| 736 | |
| 737 | $doc_url = Helper_Functions::get_campaign_link( $url, 'editor-page', 'wp-editor', 'get-support' ); |
| 738 | |
| 739 | $this->add_control('doc_' . $doc_index, |
| 740 | [ |
| 741 | 'type' => Controls_Manager::RAW_HTML, |
| 742 | 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url , __( $title, 'premium-addons-for-elementor' ) ), |
| 743 | 'content_classes' => 'editor-pa-doc', |
| 744 | ] |
| 745 | ); |
| 746 | |
| 747 | $doc_index++; |
| 748 | |
| 749 | } |
| 750 | |
| 751 | $this->end_controls_section(); |
| 752 | |
| 753 | $this->start_controls_section( |
| 754 | 'premium_modal_box_selector_style_section', |
| 755 | [ |
| 756 | 'label' => __('Trigger', 'premium-addons-for-elementor'), |
| 757 | 'tab' => Controls_Manager::TAB_STYLE, |
| 758 | 'condition' => [ |
| 759 | 'premium_modal_box_display_on!' => 'pageload', |
| 760 | ] |
| 761 | ] |
| 762 | ); |
| 763 | |
| 764 | $this->add_group_control( |
| 765 | Group_Control_Css_Filter::get_type(), |
| 766 | [ |
| 767 | 'name' => 'trigger_css_filters', |
| 768 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-animation', |
| 769 | 'condition' => [ |
| 770 | 'premium_modal_box_display_on' => 'animation' |
| 771 | ] |
| 772 | ] |
| 773 | ); |
| 774 | |
| 775 | $this->add_group_control( |
| 776 | Group_Control_Css_Filter::get_type(), |
| 777 | [ |
| 778 | 'name' => 'trigger_hover_css_filters', |
| 779 | 'label' => __('Hover CSS Filters', 'premium-addons-for-elementor'), |
| 780 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-animation:hover', |
| 781 | 'condition' => [ |
| 782 | 'premium_modal_box_display_on' => 'animation' |
| 783 | ] |
| 784 | ] |
| 785 | ); |
| 786 | |
| 787 | $this->add_control( |
| 788 | 'premium_modal_box_button_text_color', |
| 789 | [ |
| 790 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 791 | 'type' => Controls_Manager::COLOR, |
| 792 | 'scheme' => [ |
| 793 | 'type' => Scheme_Color::get_type(), |
| 794 | 'value' => Scheme_Color::COLOR_2, |
| 795 | ], |
| 796 | 'selectors' => [ |
| 797 | '{{WRAPPER}} .premium-modal-trigger-btn, {{WRAPPER}} .premium-modal-trigger-text' => 'color:{{VALUE}};', |
| 798 | ], |
| 799 | 'condition' => [ |
| 800 | 'premium_modal_box_display_on' => ['button', 'text'], |
| 801 | ] |
| 802 | ] |
| 803 | ); |
| 804 | |
| 805 | $this->add_control( |
| 806 | 'premium_modal_box_button_text_color_hover', |
| 807 | [ |
| 808 | 'label' => __('Hover Color', 'premium-addons-for-elementor'), |
| 809 | 'type' => Controls_Manager::COLOR, |
| 810 | 'scheme' => [ |
| 811 | 'type' => Scheme_Color::get_type(), |
| 812 | 'value' => Scheme_Color::COLOR_2, |
| 813 | ], |
| 814 | 'selectors' => [ |
| 815 | '{{WRAPPER}} .premium-modal-trigger-btn:hover, {{WRAPPER}} .premium-modal-trigger-text:hover' => 'color:{{VALUE}};', |
| 816 | ], |
| 817 | 'condition' => [ |
| 818 | 'premium_modal_box_display_on' => ['button', 'text'], |
| 819 | ] |
| 820 | ] |
| 821 | ); |
| 822 | |
| 823 | $this->add_control( |
| 824 | 'premium_modal_box_button_icon_color', |
| 825 | [ |
| 826 | 'label' => __('Icon Color', 'premium-addons-for-elementor'), |
| 827 | 'type' => Controls_Manager::COLOR, |
| 828 | 'scheme' => [ |
| 829 | 'type' => Scheme_Color::get_type(), |
| 830 | 'value' => Scheme_Color::COLOR_2, |
| 831 | ], |
| 832 | 'selectors' => [ |
| 833 | '{{WRAPPER}} .premium-modal-trigger-btn i' => 'color:{{VALUE}};', |
| 834 | ], |
| 835 | 'condition' => [ |
| 836 | 'premium_modal_box_display_on' => ['button'], |
| 837 | ] |
| 838 | ] |
| 839 | ); |
| 840 | |
| 841 | $this->add_control( |
| 842 | 'premium_modal_box_button_icon_hover_color', |
| 843 | [ |
| 844 | 'label' => __('Icon Hover Color', 'premium-addons-for-elementor'), |
| 845 | 'type' => Controls_Manager::COLOR, |
| 846 | 'scheme' => [ |
| 847 | 'type' => Scheme_Color::get_type(), |
| 848 | 'value' => Scheme_Color::COLOR_2, |
| 849 | ], |
| 850 | 'selectors' => [ |
| 851 | '{{WRAPPER}} .premium-modal-trigger-btn:hover i' => 'color:{{VALUE}};', |
| 852 | ], |
| 853 | 'condition' => [ |
| 854 | 'premium_modal_box_display_on' => ['button'], |
| 855 | ] |
| 856 | ] |
| 857 | ); |
| 858 | |
| 859 | $this->add_group_control( |
| 860 | Group_Control_Typography::get_type(), |
| 861 | [ |
| 862 | 'name' => 'selectortext', |
| 863 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 864 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-btn, {{WRAPPER}} .premium-modal-trigger-text', |
| 865 | 'condition' => [ |
| 866 | 'premium_modal_box_display_on' => ['button', 'text'], |
| 867 | ], |
| 868 | ] |
| 869 | ); |
| 870 | |
| 871 | $this->start_controls_tabs('premium_modal_box_button_style'); |
| 872 | |
| 873 | $this->start_controls_tab( |
| 874 | 'premium_modal_box_tab_selector_normal', |
| 875 | [ |
| 876 | 'label' => __('Normal', 'premium-addons-for-elementor'), |
| 877 | 'condition' => [ |
| 878 | 'premium_modal_box_display_on' => ['button', 'text', 'image'], |
| 879 | ] |
| 880 | ] |
| 881 | ); |
| 882 | |
| 883 | $this->add_control( |
| 884 | 'premium_modal_box_selector_background', |
| 885 | [ |
| 886 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 887 | 'type' => Controls_Manager::COLOR, |
| 888 | 'scheme' => [ |
| 889 | 'type' => Scheme_Color::get_type(), |
| 890 | 'value' => Scheme_Color::COLOR_1, |
| 891 | ], |
| 892 | 'selectors' => [ |
| 893 | '{{WRAPPER}} .premium-modal-trigger-btn' => 'background-color: {{VALUE}};', |
| 894 | ], |
| 895 | 'condition' => [ |
| 896 | 'premium_modal_box_display_on' => 'button', |
| 897 | ] |
| 898 | ] |
| 899 | ); |
| 900 | |
| 901 | $this->add_group_control( |
| 902 | Group_Control_Border::get_type(), |
| 903 | [ |
| 904 | 'name' => 'selector_border', |
| 905 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-btn,{{WRAPPER}} .premium-modal-trigger-text, {{WRAPPER}} .premium-modal-trigger-img', |
| 906 | 'condition' => [ |
| 907 | 'premium_modal_box_display_on' => ['button', 'text', 'image'], |
| 908 | ] |
| 909 | ] |
| 910 | ); |
| 911 | |
| 912 | $this->add_control( |
| 913 | 'premium_modal_box_selector_border_radius', |
| 914 | [ |
| 915 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 916 | 'type' => Controls_Manager::SLIDER, |
| 917 | 'size_units' => ['px', '%', 'em'], |
| 918 | 'default' => [ |
| 919 | 'size' => 0 |
| 920 | ], |
| 921 | 'selectors' => [ |
| 922 | '{{WRAPPER}} .premium-modal-trigger-btn, {{WRAPPER}} .premium-modal-trigger-text, {{WRAPPER}} .premium-modal-trigger-img' => 'border-radius:{{SIZE}}{{UNIT}};', |
| 923 | ], |
| 924 | 'condition' => [ |
| 925 | 'premium_modal_box_display_on' => ['button', 'text', 'image'], |
| 926 | ], |
| 927 | 'separator' => 'after', |
| 928 | ] |
| 929 | ); |
| 930 | |
| 931 | $this->add_responsive_control( |
| 932 | 'premium_modal_box_selector_padding', |
| 933 | [ |
| 934 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 935 | 'type' => Controls_Manager::DIMENSIONS, |
| 936 | 'size_units' => ['px', 'em', '%'], |
| 937 | 'default' => [ |
| 938 | 'unit' => 'px', |
| 939 | 'top' => 10, |
| 940 | 'right' => 20, |
| 941 | 'bottom' => 10, |
| 942 | 'left' => 20, |
| 943 | ], |
| 944 | 'selectors' => [ |
| 945 | '{{WRAPPER}} .premium-modal-trigger-btn, {{WRAPPER}} .premium-modal-trigger-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 946 | ], |
| 947 | 'condition' => [ |
| 948 | 'premium_modal_box_display_on' => ['button', 'text'], |
| 949 | ] |
| 950 | ] |
| 951 | ); |
| 952 | |
| 953 | $this->add_group_control( |
| 954 | Group_Control_Box_Shadow::get_type(), |
| 955 | [ |
| 956 | 'label' => __('Shadow', 'premium-addons-for-elementor'), |
| 957 | 'name' => 'premium_modal_box_selector_box_shadow', |
| 958 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-btn, {{WRAPPER}} .premium-modal-trigger-img', |
| 959 | 'condition' => [ |
| 960 | 'premium_modal_box_display_on' => ['button', 'image'], |
| 961 | ] |
| 962 | ] |
| 963 | ); |
| 964 | |
| 965 | $this->add_group_control( |
| 966 | Group_Control_Text_Shadow::get_type(), |
| 967 | [ |
| 968 | 'name' => 'premium_modal_box_selector_text_shadow', |
| 969 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-text', |
| 970 | 'condition' => [ |
| 971 | 'premium_modal_box_display_on' => 'text', |
| 972 | ] |
| 973 | ] |
| 974 | ); |
| 975 | |
| 976 | $this->end_controls_tab(); |
| 977 | |
| 978 | $this->start_controls_tab( |
| 979 | 'premium_modal_box_tab_selector_hover', |
| 980 | [ |
| 981 | 'label' => __('Hover', 'premium-addons-for-elementor'), |
| 982 | 'condition' => [ |
| 983 | 'premium_modal_box_display_on' => ['button', 'text', 'image'], |
| 984 | ] |
| 985 | ] |
| 986 | ); |
| 987 | |
| 988 | $this->add_control( |
| 989 | 'premium_modal_box_selector_hover_background', |
| 990 | [ |
| 991 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 992 | 'type' => Controls_Manager::COLOR, |
| 993 | 'selectors' => [ |
| 994 | '{{WRAPPER}} .premium-modal-trigger-btn:hover' => 'background: {{VALUE}};', |
| 995 | ], |
| 996 | 'condition' => [ |
| 997 | 'premium_modal_box_display_on' => 'button', |
| 998 | ] |
| 999 | ] |
| 1000 | ); |
| 1001 | |
| 1002 | $this->add_group_control( |
| 1003 | Group_Control_Border::get_type(), |
| 1004 | [ |
| 1005 | 'name' => 'selector_border_hover', |
| 1006 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-btn:hover, |
| 1007 | {{WRAPPER}} .premium-modal-trigger-text:hover, {{WRAPPER}} .premium-modal-trigger-img:hover', |
| 1008 | 'condition' => [ |
| 1009 | 'premium_modal_box_display_on' => ['button', 'text', 'image'], |
| 1010 | ] |
| 1011 | ] |
| 1012 | ); |
| 1013 | |
| 1014 | $this->add_control( |
| 1015 | 'premium_modal_box_selector_border_radius_hover', |
| 1016 | [ |
| 1017 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1018 | 'type' => Controls_Manager::SLIDER, |
| 1019 | 'size_units' => ['px', '%', 'em'], |
| 1020 | 'selectors' => [ |
| 1021 | '{{WRAPPER}} .premium-modal-trigger-btn:hover,{{WRAPPER}} .premium-modal-trigger-text:hover, {{WRAPPER}} .premium-modal-trigger-img:hover' => 'border-radius:{{SIZE}}{{UNIT}};', |
| 1022 | ], |
| 1023 | 'condition' => [ |
| 1024 | 'premium_modal_box_display_on' => ['button', 'text', 'image'], |
| 1025 | ] |
| 1026 | ] |
| 1027 | ); |
| 1028 | |
| 1029 | $this->add_group_control( |
| 1030 | Group_Control_Box_Shadow::get_type(), |
| 1031 | [ |
| 1032 | 'label' => __('Shadow', 'premium-addons-for-elementor'), |
| 1033 | 'name' => 'premium_modal_box_selector_box_shadow_hover', |
| 1034 | 'selector' => '{{WRAPPER}} .premium-modal-trigger-btn:hover, {{WRAPPER}} .premium-modal-trigger-text:hover, {{WRAPPER}} .premium-modal-trigger-img:hover', |
| 1035 | 'condition' => [ |
| 1036 | 'premium_modal_box_display_on' => ['button', 'text', 'image'], |
| 1037 | ] |
| 1038 | ] |
| 1039 | ); |
| 1040 | |
| 1041 | $this->end_controls_tab(); |
| 1042 | |
| 1043 | $this->end_controls_tabs(); |
| 1044 | |
| 1045 | $this->end_controls_section(); |
| 1046 | |
| 1047 | $this->start_controls_section( |
| 1048 | 'premium_modal_box_header_settings', |
| 1049 | [ |
| 1050 | 'label' => __('Header', 'premium-addons-for-elementor'), |
| 1051 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1052 | 'condition' => [ |
| 1053 | 'premium_modal_box_header_switcher' => 'yes' |
| 1054 | ], |
| 1055 | ] |
| 1056 | ); |
| 1057 | |
| 1058 | $this->add_control( |
| 1059 | 'premium_modal_box_header_text_color', |
| 1060 | [ |
| 1061 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 1062 | 'type' => Controls_Manager::COLOR, |
| 1063 | 'selectors' => [ |
| 1064 | '{{WRAPPER}} .premium-modal-box-modal-title' => 'color: {{VALUE}};', |
| 1065 | ] |
| 1066 | ] |
| 1067 | ); |
| 1068 | |
| 1069 | $this->add_group_control( |
| 1070 | Group_Control_Typography::get_type(), |
| 1071 | [ |
| 1072 | 'name' => 'headertext', |
| 1073 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 1074 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-title', |
| 1075 | ] |
| 1076 | ); |
| 1077 | |
| 1078 | $this->add_control( |
| 1079 | 'premium_modal_box_header_background', |
| 1080 | [ |
| 1081 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1082 | 'type' => Controls_Manager::COLOR, |
| 1083 | 'selectors' => [ |
| 1084 | '{{WRAPPER}} .premium-modal-box-modal-header' => 'background: {{VALUE}};', |
| 1085 | ] |
| 1086 | ] |
| 1087 | ); |
| 1088 | |
| 1089 | $this->add_group_control( |
| 1090 | Group_Control_Border::get_type(), |
| 1091 | [ |
| 1092 | 'name' => 'premium_modal_header_border', |
| 1093 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-header', |
| 1094 | ] |
| 1095 | ); |
| 1096 | |
| 1097 | $this->end_controls_section(); |
| 1098 | |
| 1099 | $this->start_controls_section( |
| 1100 | 'premium_modal_box_upper_close_button_section', |
| 1101 | [ |
| 1102 | 'label' => __('Upper Close Button', 'premium-addons-for-elementor'), |
| 1103 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1104 | 'condition' => [ |
| 1105 | 'premium_modal_box_upper_close' => 'yes', |
| 1106 | 'premium_modal_box_header_switcher' => 'yes' |
| 1107 | ] |
| 1108 | ] |
| 1109 | ); |
| 1110 | |
| 1111 | $this->add_responsive_control( |
| 1112 | 'premium_modal_box_upper_close_button_size', |
| 1113 | [ |
| 1114 | 'label' => __('Size', 'premium-addons-for-elementor'), |
| 1115 | 'type' => Controls_Manager::SLIDER, |
| 1116 | 'size_units' => ['px', '%', 'em'], |
| 1117 | 'selectors' => [ |
| 1118 | '{{WRAPPER}} .premium-modal-box-modal-header button' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1119 | ] |
| 1120 | ] |
| 1121 | ); |
| 1122 | |
| 1123 | |
| 1124 | |
| 1125 | $this->start_controls_tabs('premium_modal_box_upper_close_button_style'); |
| 1126 | |
| 1127 | $this->start_controls_tab( |
| 1128 | 'premium_modal_box_upper_close_button_normal', |
| 1129 | [ |
| 1130 | 'label' => __('Normal', 'premium-addons-for-elementor'), |
| 1131 | ] |
| 1132 | ); |
| 1133 | |
| 1134 | $this->add_control( |
| 1135 | 'premium_modal_box_upper_close_button_normal_color', |
| 1136 | [ |
| 1137 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 1138 | 'type' => Controls_Manager::COLOR, |
| 1139 | 'selectors' => [ |
| 1140 | '{{WRAPPER}} .premium-modal-box-modal-close' => 'color: {{VALUE}};', |
| 1141 | ] |
| 1142 | ] |
| 1143 | ); |
| 1144 | |
| 1145 | $this->add_control( |
| 1146 | 'premium_modal_box_upper_close_button_background_color', |
| 1147 | [ |
| 1148 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1149 | 'type' => Controls_Manager::COLOR, |
| 1150 | 'selectors' => [ |
| 1151 | '{{WRAPPER}} .premium-modal-box-modal-close' => 'background:{{VALUE}};', |
| 1152 | ], |
| 1153 | ] |
| 1154 | ); |
| 1155 | |
| 1156 | $this->add_group_control( |
| 1157 | Group_Control_Border::get_type(), |
| 1158 | [ |
| 1159 | 'name' => 'premium_modal_upper_border', |
| 1160 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-close', |
| 1161 | ] |
| 1162 | ); |
| 1163 | |
| 1164 | $this->add_control( |
| 1165 | 'premium_modal_upper_border_radius', |
| 1166 | [ |
| 1167 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1168 | 'type' => Controls_Manager::SLIDER, |
| 1169 | 'size_units' => ['px', '%', 'em'], |
| 1170 | 'selectors' => [ |
| 1171 | '{{WRAPPER}} .premium-modal-box-modal-close' => 'border-radius:{{SIZE}}{{UNIT}};', |
| 1172 | ], |
| 1173 | 'separator' => 'after', |
| 1174 | ] |
| 1175 | ); |
| 1176 | |
| 1177 | $this->end_controls_tab(); |
| 1178 | |
| 1179 | $this->start_controls_tab( |
| 1180 | 'premium_modal_box_upper_close_button_hover', |
| 1181 | [ |
| 1182 | 'label' => __('Hover', 'premium-addons-for-elementor'), |
| 1183 | ] |
| 1184 | ); |
| 1185 | |
| 1186 | $this->add_control( |
| 1187 | 'premium_modal_box_upper_close_button_hover_color', |
| 1188 | [ |
| 1189 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 1190 | 'type' => Controls_Manager::COLOR, |
| 1191 | 'selectors' => [ |
| 1192 | '{{WRAPPER}} .premium-modal-box-modal-close:hover' => 'color: {{VALUE}};', |
| 1193 | ], |
| 1194 | ] |
| 1195 | ); |
| 1196 | |
| 1197 | $this->add_control( |
| 1198 | 'premium_modal_box_upper_close_button_background_color_hover', |
| 1199 | [ |
| 1200 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1201 | 'type' => Controls_Manager::COLOR, |
| 1202 | 'selectors' => [ |
| 1203 | '{{WRAPPER}} .premium-modal-box-modal-close:hover' => 'background:{{VALUE}};', |
| 1204 | ], |
| 1205 | ] |
| 1206 | ); |
| 1207 | |
| 1208 | $this->add_group_control( |
| 1209 | Group_Control_Border::get_type(), |
| 1210 | [ |
| 1211 | 'name' => 'premium_modal_upper_border_hover', |
| 1212 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-close:hover', |
| 1213 | ] |
| 1214 | ); |
| 1215 | |
| 1216 | $this->add_control( |
| 1217 | 'premium_modal_upper_border_radius_hover', |
| 1218 | [ |
| 1219 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1220 | 'type' => Controls_Manager::SLIDER, |
| 1221 | 'size_units' => ['px', '%', 'em'], |
| 1222 | 'selectors' => [ |
| 1223 | '{{WRAPPER}} .premium-modal-box-modal-close:hover' => 'border-radius:{{SIZE}}{{UNIT}};', |
| 1224 | ], |
| 1225 | 'separator' => 'after', |
| 1226 | ] |
| 1227 | ); |
| 1228 | |
| 1229 | $this->end_controls_tab(); |
| 1230 | |
| 1231 | $this->end_controls_tabs(); |
| 1232 | |
| 1233 | $this->add_responsive_control( |
| 1234 | 'premium_modal_box_upper_close_button_padding', |
| 1235 | [ |
| 1236 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 1237 | 'type' => Controls_Manager::DIMENSIONS, |
| 1238 | 'size_units' => ['px', 'em', '%'], |
| 1239 | 'selectors' => [ |
| 1240 | '{{WRAPPER}} .premium-modal-box-modal-close' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1241 | ] |
| 1242 | ] |
| 1243 | ); |
| 1244 | |
| 1245 | $this->end_controls_section(); |
| 1246 | |
| 1247 | $this->start_controls_section( |
| 1248 | 'premium_modal_box_lower_close_button_section', |
| 1249 | [ |
| 1250 | 'label' => __('Lower Close Button', 'premium-addons-for-elementor'), |
| 1251 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1252 | 'condition' => [ |
| 1253 | 'premium_modal_box_lower_close' => 'yes', |
| 1254 | ] |
| 1255 | ] |
| 1256 | ); |
| 1257 | |
| 1258 | $this->add_group_control( |
| 1259 | Group_Control_Typography::get_type(), |
| 1260 | [ |
| 1261 | 'name' => 'lowerclose', |
| 1262 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 1263 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-lower-close', |
| 1264 | ] |
| 1265 | ); |
| 1266 | |
| 1267 | $this->add_responsive_control( |
| 1268 | 'premium_modal_box_lower_close_button_width', |
| 1269 | [ |
| 1270 | 'label' => __('Width', 'premium-addons-for-elementor'), |
| 1271 | 'type' => Controls_Manager::SLIDER, |
| 1272 | 'size_units' => ['px', '%', 'em'], |
| 1273 | 'range' => [ |
| 1274 | 'px' => [ |
| 1275 | 'min' => 1, |
| 1276 | 'max' => 500, |
| 1277 | ], |
| 1278 | 'em' => [ |
| 1279 | 'min' => 1, |
| 1280 | 'max' => 30, |
| 1281 | ], |
| 1282 | ], |
| 1283 | 'selectors' => [ |
| 1284 | '{{WRAPPER}} .premium-modal-box-modal-lower-close' => 'min-width: {{SIZE}}{{UNIT}};', |
| 1285 | ] |
| 1286 | ] |
| 1287 | ); |
| 1288 | |
| 1289 | |
| 1290 | $this->start_controls_tabs('premium_modal_box_lower_close_button_style'); |
| 1291 | |
| 1292 | $this->start_controls_tab( |
| 1293 | 'premium_modal_box_lower_close_button_normal', |
| 1294 | [ |
| 1295 | 'label' => __('Normal', 'premium-addons-for-elementor'), |
| 1296 | ] |
| 1297 | ); |
| 1298 | |
| 1299 | $this->add_control( |
| 1300 | 'premium_modal_box_lower_close_button_normal_color', |
| 1301 | [ |
| 1302 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 1303 | 'type' => Controls_Manager::COLOR, |
| 1304 | 'scheme' => [ |
| 1305 | 'type' => Scheme_Color::get_type(), |
| 1306 | 'value' => Scheme_Color::COLOR_2, |
| 1307 | ], |
| 1308 | 'selectors' => [ |
| 1309 | '{{WRAPPER}} .premium-modal-box-modal-lower-close' => 'color: {{VALUE}};', |
| 1310 | ] |
| 1311 | ] |
| 1312 | ); |
| 1313 | |
| 1314 | $this->add_control( |
| 1315 | 'premium_modal_box_lower_close_button_background_normal_color', |
| 1316 | [ |
| 1317 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1318 | 'type' => Controls_Manager::COLOR, |
| 1319 | 'scheme' => [ |
| 1320 | 'type' => Scheme_Color::get_type(), |
| 1321 | 'value' => Scheme_Color::COLOR_1, |
| 1322 | ], |
| 1323 | 'selectors' => [ |
| 1324 | '{{WRAPPER}} .premium-modal-box-modal-lower-close' => 'background-color: {{VALUE}};', |
| 1325 | ], |
| 1326 | ] |
| 1327 | ); |
| 1328 | |
| 1329 | $this->add_group_control( |
| 1330 | Group_Control_Border::get_type(), |
| 1331 | [ |
| 1332 | 'name' => 'premium_modal_box_lower_close_border', |
| 1333 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-lower-close', |
| 1334 | ] |
| 1335 | ); |
| 1336 | |
| 1337 | $this->add_control( |
| 1338 | 'premium_modal_box_lower_close_border_radius', |
| 1339 | [ |
| 1340 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1341 | 'type' => Controls_Manager::SLIDER, |
| 1342 | 'size_units' => ['px', '%', 'em'], |
| 1343 | 'selectors' => [ |
| 1344 | '{{WRAPPER}} .premium-modal-box-modal-lower-close' => 'border-radius: {{SIZE}}{{UNIT}};' |
| 1345 | ], |
| 1346 | 'separator' => 'after', |
| 1347 | ] |
| 1348 | ); |
| 1349 | |
| 1350 | $this->end_controls_tab(); |
| 1351 | |
| 1352 | $this->start_controls_tab( |
| 1353 | 'premium_modal_box_lower_close_button_hover', |
| 1354 | [ |
| 1355 | 'label' => __('Hover', 'premium-addons-for-elementor'), |
| 1356 | ] |
| 1357 | ); |
| 1358 | |
| 1359 | $this->add_control( |
| 1360 | 'premium_modal_box_lower_close_button_hover_color', |
| 1361 | [ |
| 1362 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 1363 | 'type' => Controls_Manager::COLOR, |
| 1364 | 'scheme' => [ |
| 1365 | 'type' => Scheme_Color::get_type(), |
| 1366 | 'value' => Scheme_Color::COLOR_1, |
| 1367 | ], |
| 1368 | 'selectors' => [ |
| 1369 | '{{WRAPPER}} .premium-modal-box-modal-lower-close:hover' => 'color: {{VALUE}};', |
| 1370 | ] |
| 1371 | ] |
| 1372 | ); |
| 1373 | |
| 1374 | $this->add_control( |
| 1375 | 'premium_modal_box_lower_close_button_background_hover_color', |
| 1376 | [ |
| 1377 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1378 | 'type' => Controls_Manager::COLOR, |
| 1379 | 'scheme' => [ |
| 1380 | 'type' => Scheme_Color::get_type(), |
| 1381 | 'value' => Scheme_Color::COLOR_2, |
| 1382 | ], |
| 1383 | 'selectors' => [ |
| 1384 | '{{WRAPPER}} .premium-modal-box-modal-lower-close:hover' => 'background-color: {{VALUE}};', |
| 1385 | ], |
| 1386 | ] |
| 1387 | ); |
| 1388 | |
| 1389 | $this->add_group_control( |
| 1390 | Group_Control_Border::get_type(), |
| 1391 | [ |
| 1392 | 'name' => 'premium_modal_box_lower_close_border_hover', |
| 1393 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-lower-close:hover', |
| 1394 | ] |
| 1395 | ); |
| 1396 | |
| 1397 | $this->add_control( |
| 1398 | 'premium_modal_box_lower_close_border_radius_hover', |
| 1399 | [ |
| 1400 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1401 | 'type' => Controls_Manager::SLIDER, |
| 1402 | 'size_units' => ['px', '%', 'em'], |
| 1403 | 'selectors' => [ |
| 1404 | '{{WRAPPER}} .premium-modal-box-modal-lower-close:hover' => 'border-radius: {{SIZE}}{{UNIT}};' |
| 1405 | ], |
| 1406 | 'separator' => 'after', |
| 1407 | ] |
| 1408 | ); |
| 1409 | |
| 1410 | $this->end_controls_tab(); |
| 1411 | |
| 1412 | $this->end_controls_tabs(); |
| 1413 | |
| 1414 | $this->add_responsive_control( |
| 1415 | 'premium_modal_box_lower_close_button_padding', |
| 1416 | [ |
| 1417 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 1418 | 'type' => Controls_Manager::DIMENSIONS, |
| 1419 | 'size_units' => ['px', 'em', '%'], |
| 1420 | 'selectors' => [ |
| 1421 | '{{WRAPPER}} .premium-modal-box-modal-lower-close' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1422 | ] |
| 1423 | ] |
| 1424 | ); |
| 1425 | |
| 1426 | $this->end_controls_section(); |
| 1427 | |
| 1428 | $this->start_controls_section( |
| 1429 | 'premium_modal_box_style', |
| 1430 | [ |
| 1431 | 'label' => __('Modal Box', 'premium-addons-for-elementor'), |
| 1432 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1433 | ] |
| 1434 | ); |
| 1435 | |
| 1436 | $this->add_group_control( |
| 1437 | Group_Control_Typography::get_type(), |
| 1438 | [ |
| 1439 | 'name' => 'content_typography', |
| 1440 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-body', |
| 1441 | 'condition' => [ |
| 1442 | 'premium_modal_box_content_type' => 'editor' |
| 1443 | ], |
| 1444 | ] |
| 1445 | ); |
| 1446 | |
| 1447 | $this->add_control( |
| 1448 | 'premium_modal_box_content_background', |
| 1449 | [ |
| 1450 | 'label' => __('Content Background Color', 'premium-addons-for-elementor'), |
| 1451 | 'type' => Controls_Manager::COLOR, |
| 1452 | 'selectors' => [ |
| 1453 | '{{WRAPPER}} .premium-modal-box-modal-body' => 'background: {{VALUE}};', |
| 1454 | ] |
| 1455 | ] |
| 1456 | ); |
| 1457 | |
| 1458 | $this->add_control( |
| 1459 | 'premium_modal_box_modal_size', |
| 1460 | [ |
| 1461 | 'label' => __('Width', 'premium-addons-for-elementor'), |
| 1462 | 'type' => Controls_Manager::SLIDER, |
| 1463 | 'size_units' => ['px', '%', 'em'], |
| 1464 | 'range' => [ |
| 1465 | 'px' => [ |
| 1466 | 'min' => 50, |
| 1467 | 'max' => 1000, |
| 1468 | ] |
| 1469 | ], |
| 1470 | 'separator' => 'before', |
| 1471 | 'label_block' => true, |
| 1472 | ] |
| 1473 | ); |
| 1474 | |
| 1475 | $this->add_responsive_control( |
| 1476 | 'premium_modal_box_modal_max_height', |
| 1477 | [ |
| 1478 | 'label' => __('Max Height', 'premium-addons-for-elementor'), |
| 1479 | 'type' => Controls_Manager::SLIDER, |
| 1480 | 'size_units' => ['px', 'em'], |
| 1481 | 'range' => [ |
| 1482 | 'px' => [ |
| 1483 | 'min' => 50, |
| 1484 | 'max' => 1000, |
| 1485 | ] |
| 1486 | ], |
| 1487 | 'label_block' => true, |
| 1488 | 'selectors' => [ |
| 1489 | '{{WRAPPER}} .premium-modal-box-modal-dialog' => 'max-height: {{SIZE}}{{UNIT}};', |
| 1490 | ] |
| 1491 | ] |
| 1492 | ); |
| 1493 | |
| 1494 | $this->add_group_control( |
| 1495 | Group_Control_Background::get_type(), |
| 1496 | [ |
| 1497 | 'name' => 'premium_modal_box_modal_background', |
| 1498 | 'types' => ['classic', 'gradient'], |
| 1499 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal' |
| 1500 | ] |
| 1501 | ); |
| 1502 | |
| 1503 | $this->add_control( |
| 1504 | 'premium_modal_box_footer_background', |
| 1505 | [ |
| 1506 | 'label' => __('Footer Background Color', 'premium-addons-for-elementor'), |
| 1507 | 'type' => Controls_Manager::COLOR, |
| 1508 | 'selectors' => [ |
| 1509 | '{{WRAPPER}} .premium-modal-box-modal-footer' => 'background: {{VALUE}};', |
| 1510 | ] |
| 1511 | ] |
| 1512 | ); |
| 1513 | |
| 1514 | $this->add_group_control( |
| 1515 | Group_Control_Border::get_type(), |
| 1516 | [ |
| 1517 | 'name' => 'contentborder', |
| 1518 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-content', |
| 1519 | ] |
| 1520 | ); |
| 1521 | |
| 1522 | $this->add_control( |
| 1523 | 'premium_modal_box_border_radius', |
| 1524 | [ |
| 1525 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1526 | 'type' => Controls_Manager::SLIDER, |
| 1527 | 'size_units' => ['px', '%', 'em'], |
| 1528 | 'selectors' => [ |
| 1529 | '{{WRAPPER}} .premium-modal-box-modal-content' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1530 | ] |
| 1531 | ] |
| 1532 | ); |
| 1533 | |
| 1534 | $this->add_group_control( |
| 1535 | Group_Control_Box_Shadow::get_type(), |
| 1536 | [ |
| 1537 | 'name' => 'premium_modal_box_shadow', |
| 1538 | 'selector' => '{{WRAPPER}} .premium-modal-box-modal-dialog', |
| 1539 | ] |
| 1540 | ); |
| 1541 | |
| 1542 | $this->add_responsive_control( |
| 1543 | 'premium_modal_box_margin', |
| 1544 | [ |
| 1545 | 'label' => __('Margin', 'premium-addons-for-elementor'), |
| 1546 | 'type' => Controls_Manager::DIMENSIONS, |
| 1547 | 'size_units' => ['px', 'em', '%'], |
| 1548 | 'selectors' => [ |
| 1549 | '{{WRAPPER}} .premium-modal-box-modal-dialog' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1550 | ] |
| 1551 | ] |
| 1552 | ); |
| 1553 | |
| 1554 | $this->add_responsive_control( |
| 1555 | 'premium_modal_box_padding', |
| 1556 | [ |
| 1557 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 1558 | 'type' => Controls_Manager::DIMENSIONS, |
| 1559 | 'size_units' => ['px', 'em', '%'], |
| 1560 | 'selectors' => [ |
| 1561 | '{{WRAPPER}} .premium-modal-box-modal-body' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1562 | ] |
| 1563 | ] |
| 1564 | ); |
| 1565 | |
| 1566 | $this->end_controls_section(); |
| 1567 | } |
| 1568 | |
| 1569 | |
| 1570 | protected function render_header_icon($new, $migrate) |
| 1571 | { |
| 1572 | |
| 1573 | $settings = $this->get_settings_for_display(); |
| 1574 | |
| 1575 | $header_icon = $settings['premium_modal_box_icon_selection']; |
| 1576 | |
| 1577 | if ('fonticon' === $header_icon) { |
| 1578 | if ($new || $migrate) : |
| 1579 | Icons_Manager::render_icon($settings['premium_modal_box_font_icon_updated'], ['aria-hidden' => 'true']); |
| 1580 | else : ?> |
| 1581 | <i <?php echo $this->get_render_attribute_string('title_icon'); ?>></i> |
| 1582 | <?php endif; |
| 1583 | } elseif ('image' === $header_icon) { |
| 1584 | ?> |
| 1585 | <img <?php echo $this->get_render_attribute_string('title_icon'); ?>> |
| 1586 | <?php |
| 1587 | } elseif ('animation' === $header_icon) { |
| 1588 | $this->add_render_attribute( 'header_lottie', [ |
| 1589 | 'class' => [ |
| 1590 | 'premium-modal-header-lottie', |
| 1591 | 'premium-lottie-animation' |
| 1592 | ], |
| 1593 | 'data-lottie-url' => $settings['header_lottie_url'], |
| 1594 | 'data-lottie-loop' => $settings['header_lottie_loop'], |
| 1595 | 'data-lottie-reverse' => $settings['header_lottie_reverse'] |
| 1596 | ]); |
| 1597 | ?> |
| 1598 | <div <?php echo $this->get_render_attribute_string( 'header_lottie' ); ?>></div> |
| 1599 | <?php |
| 1600 | } |
| 1601 | } |
| 1602 | |
| 1603 | protected function render() { |
| 1604 | |
| 1605 | $settings = $this->get_settings_for_display(); |
| 1606 | |
| 1607 | $trigger = $settings['premium_modal_box_display_on']; |
| 1608 | |
| 1609 | $this->add_inline_editing_attributes('premium_modal_box_selector_text'); |
| 1610 | |
| 1611 | $this->add_render_attribute('trigger', 'data-toggle', 'premium-modal'); |
| 1612 | |
| 1613 | $this->add_render_attribute('trigger', 'data-target', '#premium-modal-' . $this->get_id()); |
| 1614 | |
| 1615 | if( 'button' === $trigger ) { |
| 1616 | if ( !empty( $settings['premium_modal_box_button_icon_selection'] ) ) { |
| 1617 | $this->add_render_attribute('icon', 'class', $settings['premium_modal_box_button_icon_selection'] ); |
| 1618 | $this->add_render_attribute('icon', 'aria-hidden', 'true'); |
| 1619 | } |
| 1620 | |
| 1621 | $migrated = isset($settings['__fa4_migrated']['premium_modal_box_button_icon_selection_updated']); |
| 1622 | $is_new = empty($settings['premium_modal_box_button_icon_selection']) && Icons_Manager::is_migration_allowed(); |
| 1623 | |
| 1624 | $this->add_render_attribute('trigger', 'type', 'button'); |
| 1625 | |
| 1626 | $this->add_render_attribute('trigger', 'class', [ |
| 1627 | 'premium-modal-trigger-btn', |
| 1628 | 'premium-btn-' . $settings['premium_modal_box_button_size'] |
| 1629 | ] |
| 1630 | ); |
| 1631 | |
| 1632 | } elseif( 'image' === $trigger ) { |
| 1633 | |
| 1634 | $this->add_render_attribute('trigger', 'class', 'premium-modal-trigger-img'); |
| 1635 | |
| 1636 | $this->add_render_attribute('trigger', 'src', $settings['premium_modal_box_image_src']['url']); |
| 1637 | |
| 1638 | $alt = Control_Media::get_image_alt($settings['premium_modal_box_image_src']); |
| 1639 | $this->add_render_attribute('trigger', 'alt', $alt); |
| 1640 | |
| 1641 | } elseif( 'text' === $trigger ) { |
| 1642 | $this->add_render_attribute('trigger', 'class', 'premium-modal-trigger-text'); |
| 1643 | } elseif( 'animation' === $trigger ) { |
| 1644 | |
| 1645 | $this->add_render_attribute( 'trigger', [ |
| 1646 | 'class' => [ |
| 1647 | 'premium-modal-trigger-animation', |
| 1648 | 'premium-lottie-animation' |
| 1649 | ], |
| 1650 | 'data-lottie-url' => $settings['lottie_url'], |
| 1651 | 'data-lottie-loop' => $settings['lottie_loop'], |
| 1652 | 'data-lottie-reverse' => $settings['lottie_reverse'], |
| 1653 | 'data-lottie-hover' => $settings['lottie_hover'] |
| 1654 | ]); |
| 1655 | |
| 1656 | } |
| 1657 | |
| 1658 | if( 'template' === $settings['premium_modal_box_content_type'] ) { |
| 1659 | $template = $settings['premium_modal_box_content_temp']; |
| 1660 | } |
| 1661 | |
| 1662 | if ( 'yes' === $settings['premium_modal_box_header_switcher'] ) { |
| 1663 | |
| 1664 | $header_icon = $settings['premium_modal_box_icon_selection']; |
| 1665 | |
| 1666 | $header_migrated = false; |
| 1667 | $header_new = false; |
| 1668 | |
| 1669 | if ('fonticon' === $header_icon) { |
| 1670 | |
| 1671 | if (!empty($settings['premium_modal_box_font_icon'])) { |
| 1672 | $this->add_render_attribute('title_icon', 'class', $settings['premium_modal_box_font_icon']); |
| 1673 | $this->add_render_attribute('title_icon', 'aria-hidden', 'true'); |
| 1674 | } |
| 1675 | |
| 1676 | $header_migrated = isset($settings['__fa4_migrated']['premium_modal_box_font_icon_updated']); |
| 1677 | $header_new = empty($settings['premium_modal_box_font_icon']) && Icons_Manager::is_migration_allowed(); |
| 1678 | } elseif( 'image' === $header_icon ) { |
| 1679 | |
| 1680 | $this->add_render_attribute('title_icon', 'src', $settings['premium_modal_box_image_icon']['url']); |
| 1681 | |
| 1682 | $alt = Control_Media::get_image_alt($settings['premium_modal_box_image_icon']); |
| 1683 | $this->add_render_attribute('title_icon', 'alt', $alt); |
| 1684 | |
| 1685 | } |
| 1686 | } |
| 1687 | |
| 1688 | $modal_settings = [ |
| 1689 | 'trigger' => $trigger |
| 1690 | ]; |
| 1691 | |
| 1692 | if( 'pageload' === $trigger ) { |
| 1693 | $modal_settings['delay'] = $settings['premium_modal_box_popup_delay']; |
| 1694 | } |
| 1695 | |
| 1696 | $this->add_render_attribute('modal', 'class', ['container', 'premium-modal-box-container']); |
| 1697 | |
| 1698 | $this->add_render_attribute('modal', 'data-settings', wp_json_encode($modal_settings)); |
| 1699 | |
| 1700 | $this->add_render_attribute('dialog', 'class', "premium-modal-box-modal-dialog"); |
| 1701 | |
| 1702 | |
| 1703 | $animation_class = $settings['premium_modal_box_animation']; |
| 1704 | if( '' != $settings['premium_modal_box_animation_duration'] ) { |
| 1705 | $animation_dur = 'animated-' . $settings['premium_modal_box_animation_duration']; |
| 1706 | } else { |
| 1707 | $animation_dur = 'animated-'; |
| 1708 | } |
| 1709 | $this->add_render_attribute( 'dialog', 'data-modal-animation', |
| 1710 | [ |
| 1711 | $animation_class, |
| 1712 | $animation_dur, |
| 1713 | ] |
| 1714 | ); |
| 1715 | |
| 1716 | $this->add_render_attribute( 'dialog', 'data-delay-animation', $settings['premium_modal_box_animation_delay']); |
| 1717 | |
| 1718 | ?> |
| 1719 | |
| 1720 | <div <?php echo $this->get_render_attribute_string('modal') ?>> |
| 1721 | <div class="premium-modal-trigger-container"> |
| 1722 | <?php |
| 1723 | if ( 'button' === $trigger ) : ?> |
| 1724 | <button <?php echo $this->get_render_attribute_string('trigger'); ?>> |
| 1725 | <?php if ('yes' === $settings['premium_modal_box_icon_switcher'] && $settings['premium_modal_box_icon_position'] === 'before') : |
| 1726 | if ($is_new || $migrated) : |
| 1727 | Icons_Manager::render_icon($settings['premium_modal_box_button_icon_selection_updated'], ['aria-hidden' => 'true']); |
| 1728 | else : ?> |
| 1729 | <i <?php echo $this->get_render_attribute_string('icon'); ?>></i> |
| 1730 | <?php endif; |
| 1731 | endif; ?> |
| 1732 | <span><?php echo $settings['premium_modal_box_button_text']; ?></span> |
| 1733 | <?php if ('yes' === $settings['premium_modal_box_icon_switcher'] && $settings['premium_modal_box_icon_position'] === 'after') : |
| 1734 | if ($is_new || $migrated) : |
| 1735 | Icons_Manager::render_icon($settings['premium_modal_box_button_icon_selection_updated'], ['aria-hidden' => 'true']); |
| 1736 | else: ?> |
| 1737 | <i <?php echo $this->get_render_attribute_string('icon'); ?>></i> |
| 1738 | <?php endif; |
| 1739 | endif; ?> |
| 1740 | </button> |
| 1741 | <?php elseif ($trigger === 'image') : ?> |
| 1742 | <img <?php echo $this->get_render_attribute_string('trigger'); ?>> |
| 1743 | <?php elseif ($trigger === 'text') : ?> |
| 1744 | <span <?php echo $this->get_render_attribute_string('trigger'); ?>> |
| 1745 | <div <?php echo $this->get_render_attribute_string('premium_modal_box_selector_text'); ?>><?php echo $settings['premium_modal_box_selector_text']; ?></div> |
| 1746 | </span> |
| 1747 | <?php elseif ($trigger === 'animation') : ?> |
| 1748 | <div <?php echo $this->get_render_attribute_string( 'trigger' ); ?>></div> |
| 1749 | <?php endif; ?> |
| 1750 | </div> |
| 1751 | |
| 1752 | <div id="premium-modal-<?php echo $this->get_id(); ?>" class="premium-modal-box-modal" role="dialog"> |
| 1753 | <div <?php echo $this->get_render_attribute_string( 'dialog' ); ?>> |
| 1754 | <div class="premium-modal-box-modal-content"> |
| 1755 | <?php if ($settings['premium_modal_box_header_switcher'] === 'yes') : ?> |
| 1756 | <div class="premium-modal-box-modal-header"> |
| 1757 | <?php if (!empty($settings['premium_modal_box_title'])) : ?> |
| 1758 | <h3 class="premium-modal-box-modal-title"> |
| 1759 | <?php $this->render_header_icon($header_new, $header_migrated); |
| 1760 | echo $settings['premium_modal_box_title']; ?> |
| 1761 | </h3> |
| 1762 | <?php endif; ?> |
| 1763 | <?php if ($settings['premium_modal_box_upper_close'] === 'yes') : ?> |
| 1764 | <div class="premium-modal-box-close-button-container"> |
| 1765 | <button type="button" class="premium-modal-box-modal-close" data-dismiss="premium-modal">×</button> |
| 1766 | </div> |
| 1767 | <?php endif; ?> |
| 1768 | </div> |
| 1769 | <?php endif; ?> |
| 1770 | <div class="premium-modal-box-modal-body"> |
| 1771 | <?php if ($settings['premium_modal_box_content_type'] === 'editor') : |
| 1772 | echo $this->parse_text_editor( $settings['premium_modal_box_content'] ); |
| 1773 | else : |
| 1774 | echo $this->getTemplateInstance()->get_template_content( $template ); |
| 1775 | endif; ?> |
| 1776 | </div> |
| 1777 | <?php if ($settings['premium_modal_box_lower_close'] === 'yes') : ?> |
| 1778 | <div class="premium-modal-box-modal-footer"> |
| 1779 | <button type="button" class="premium-modal-box-modal-lower-close" data-dismiss="premium-modal"> |
| 1780 | <?php echo $settings['premium_modal_close_text']; ?> |
| 1781 | </button> |
| 1782 | </div> |
| 1783 | <?php endif; ?> |
| 1784 | </div> |
| 1785 | </div> |
| 1786 | </div> |
| 1787 | </div> |
| 1788 | <style> |
| 1789 | <?php if ( ! empty( $settings['premium_modal_box_modal_size']['size'] ) ) : |
| 1790 | echo '@media (min-width: 992px) {'; ?>#premium-modal-<?php echo $this->get_id(); ?> .premium-modal-box-modal-dialog { |
| 1791 | width: <?php echo $settings['premium_modal_box_modal_size']['size'] . $settings['premium_modal_box_modal_size']['unit']; ?> |
| 1792 | } |
| 1793 | <?php echo '}'; |
| 1794 | endif; ?> |
| 1795 | </style> |
| 1796 | |
| 1797 | <?php |
| 1798 | } |
| 1799 | } |
| 1800 |