wpr-flip-carousel.php
1397 lines
| 1 | <?php |
| 2 | namespace WprAddons\Modules\FlipCarousel\Widgets; |
| 3 | |
| 4 | use Elementor\Widget_Base; |
| 5 | use Elementor\Controls_Manager; |
| 6 | use Elementor\Group_Control_Border; |
| 7 | use Elementor\Group_Control_Box_Shadow; |
| 8 | use Elementor\Group_Control_Text_Shadow; |
| 9 | use Elementor\Group_Control_Background; |
| 10 | use Elementor\Group_Control_Typography; |
| 11 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 12 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 13 | use Elementor\Repeater; |
| 14 | use Elementor\Group_Control_Image_Size; |
| 15 | use Elementor\Utils; |
| 16 | use WprAddons\Classes\Utilities; |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; // Exit if accessed directly. |
| 20 | } |
| 21 | |
| 22 | class Wpr_Flip_Carousel extends Widget_Base { |
| 23 | |
| 24 | public function get_name() { |
| 25 | return 'wpr-flip-carousel'; |
| 26 | } |
| 27 | |
| 28 | public function get_title() { |
| 29 | return esc_html__( 'Flip Carousel', 'wpr-addons' ); |
| 30 | } |
| 31 | |
| 32 | public function get_icon() { |
| 33 | return 'wpr-icon eicon-media-carousel'; |
| 34 | } |
| 35 | |
| 36 | public function get_categories() { |
| 37 | return [ 'wpr-widgets']; |
| 38 | } |
| 39 | |
| 40 | public function get_keywords() { |
| 41 | return [ 'royal', 'flip carousel', 'flip', 'carousel', 'flip slider' ]; |
| 42 | } |
| 43 | |
| 44 | public function has_widget_inner_wrapper(): bool { |
| 45 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 46 | } |
| 47 | |
| 48 | public function get_script_depends() { |
| 49 | return [ 'wpr-flipster' ]; |
| 50 | } |
| 51 | |
| 52 | public function get_style_depends() { |
| 53 | return [ 'wpr-flipster-css' ]; |
| 54 | } |
| 55 | |
| 56 | public function get_custom_help_url() { |
| 57 | if ( empty(get_option('wpr_wl_plugin_links')) ) |
| 58 | // return 'https://royal-elementor-addons.com/contact/?ref=rea-plugin-panel-advanced-slider-help-btn'; |
| 59 | return 'https://wordpress.org/support/plugin/royal-elementor-addons/'; |
| 60 | } |
| 61 | |
| 62 | public function add_controls_group_autoplay() { |
| 63 | $this->add_control( |
| 64 | 'autoplay', |
| 65 | [ |
| 66 | 'label' => sprintf( __( 'Autoplay %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ), |
| 67 | 'type' => Controls_Manager::SWITCHER, |
| 68 | 'classes' => 'wpr-pro-control no-distance' |
| 69 | ] |
| 70 | ); |
| 71 | } |
| 72 | |
| 73 | protected function register_controls() { |
| 74 | |
| 75 | $this->start_controls_section( |
| 76 | 'section_flip_carousel', |
| 77 | [ |
| 78 | 'label' => esc_html__( 'Slides', 'wpr-addons' ), |
| 79 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 80 | ] |
| 81 | ); |
| 82 | |
| 83 | Utilities::wpr_library_buttons( $this, Controls_Manager::RAW_HTML ); |
| 84 | |
| 85 | $repeater = new Repeater(); |
| 86 | |
| 87 | $repeater->add_control( |
| 88 | 'image', |
| 89 | [ |
| 90 | 'label' => __( 'Choose Image', 'wpr-addons' ), |
| 91 | 'type' => Controls_Manager::MEDIA, |
| 92 | 'dynamic' => [ |
| 93 | 'active' => true, |
| 94 | ], |
| 95 | 'default' => [ |
| 96 | 'url' => WPR_ADDONS_ASSETS_URL . 'img/logo-slider-450x450.png', |
| 97 | ], |
| 98 | ] |
| 99 | ); |
| 100 | |
| 101 | $repeater->add_control( |
| 102 | 'slide_text', |
| 103 | [ |
| 104 | 'label' => esc_html__( 'Image Caption', 'wpr-addons' ), |
| 105 | 'type' => Controls_Manager::TEXT, |
| 106 | 'dynamic' => [ |
| 107 | 'active' => true, |
| 108 | ], |
| 109 | 'default' => 'Image Caption', |
| 110 | 'description' => 'Show/Hide Image Caption from Settings tab.' |
| 111 | // 'condition' => [ |
| 112 | // 'enable_figcaption' => 'yes' |
| 113 | // ] |
| 114 | ] |
| 115 | ); |
| 116 | |
| 117 | $repeater->add_control( |
| 118 | 'slide_subcaption', |
| 119 | [ |
| 120 | 'label' => esc_html__( 'Subcaption', 'wpr-addons' ), |
| 121 | 'type' => Controls_Manager::TEXT, |
| 122 | 'dynamic' => [ |
| 123 | 'active' => true, |
| 124 | ], |
| 125 | 'default' => 'Subcaption', |
| 126 | 'description' => 'Show/Hide Subcaption from Settings tab.' |
| 127 | // 'condition' => [ |
| 128 | // 'enable_figcaption' => 'yes' |
| 129 | // ] |
| 130 | ] |
| 131 | ); |
| 132 | |
| 133 | $repeater->add_control( |
| 134 | 'enable_slide_link', |
| 135 | [ |
| 136 | 'label' => __( 'Enable Slide Link', 'wpr-addons' ), |
| 137 | 'type' => Controls_Manager::SWITCHER, |
| 138 | 'return_value' => 'yes', |
| 139 | 'default' => 'yes', |
| 140 | ] |
| 141 | ); |
| 142 | |
| 143 | $repeater->add_control( |
| 144 | 'slide_link', |
| 145 | [ |
| 146 | 'label' => __( 'Link', 'wpr-addons' ), |
| 147 | 'type' => Controls_Manager::URL, |
| 148 | 'dynamic' => [ |
| 149 | 'active' => true, |
| 150 | ], |
| 151 | 'placeholder' => __( 'https://your-link.com', 'wpr-addons' ), |
| 152 | 'show_external' => true, |
| 153 | 'default' => [ |
| 154 | 'url' => '', |
| 155 | 'is_external' => true, |
| 156 | 'nofollow' => true, |
| 157 | ], |
| 158 | 'condition' => [ |
| 159 | 'enable_slide_link' => 'yes' |
| 160 | ] |
| 161 | ] |
| 162 | ); |
| 163 | |
| 164 | $this->add_control( |
| 165 | 'carousel_elements', |
| 166 | [ |
| 167 | 'label' => esc_html__( 'Carousel Elements', 'wpr-addons' ), |
| 168 | 'type' => Controls_Manager::REPEATER, |
| 169 | 'fields' => $repeater->get_controls(), |
| 170 | 'default' => [ |
| 171 | [ |
| 172 | 'element_select' => esc_html__('title', 'wpr-addons'), |
| 173 | 'image' => WPR_ADDONS_ASSETS_URL . 'img/logo-slider-450x450.png' |
| 174 | ], |
| 175 | [ |
| 176 | 'element_select' => esc_html__('title', 'wpr-addons'), |
| 177 | 'image' => WPR_ADDONS_ASSETS_URL . 'img/logo-slider-450x450.png' |
| 178 | ], |
| 179 | [ |
| 180 | 'element_select' => esc_html__('title', 'wpr-addons'), |
| 181 | 'image' => WPR_ADDONS_ASSETS_URL . 'img/logo-slider-450x450.png' |
| 182 | ], |
| 183 | ], |
| 184 | ] |
| 185 | ); |
| 186 | |
| 187 | if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) { |
| 188 | $this->add_control( |
| 189 | 'slider_repeater_pro_notice', |
| 190 | [ |
| 191 | 'type' => Controls_Manager::RAW_HTML, |
| 192 | 'raw' => 'More than 4 Slides are available<br> in the <strong><a href="https://royal-elementor-addons.com/?ref=rea-plugin-panel-flip-carousel-upgrade-pro#purchasepro" target="_blank">Pro version</a></strong>', |
| 193 | // 'raw' => 'More than 4 Slides are available<br> in the <strong><a href="'. admin_url('admin.php?page=wpr-addons-pricing') .'" target="_blank">Pro version</a></strong>', |
| 194 | 'content_classes' => 'wpr-pro-notice', |
| 195 | ] |
| 196 | ); |
| 197 | } |
| 198 | |
| 199 | $this->end_controls_section(); |
| 200 | |
| 201 | $this->start_controls_section( |
| 202 | 'section_flip_carousel_settings', |
| 203 | [ |
| 204 | 'label' => esc_html__( 'Settings', 'wpr-addons' ), |
| 205 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 206 | ] |
| 207 | ); |
| 208 | |
| 209 | $this->add_group_control( |
| 210 | Group_Control_Image_Size::get_type(), |
| 211 | [ |
| 212 | 'name' => 'flip_carousel_image_size', |
| 213 | 'default' => 'medium_large', |
| 214 | // 'exclude' => ['custom'] |
| 215 | ] |
| 216 | ); |
| 217 | |
| 218 | $this->add_control( |
| 219 | 'spacing', |
| 220 | [ |
| 221 | 'label' => __( 'Slide Spacing', 'wpr-addons' ), |
| 222 | 'type' => Controls_Manager::NUMBER, |
| 223 | 'default' => -0.6, |
| 224 | 'min' => -1, |
| 225 | 'max' => 1, |
| 226 | 'step' => 0.1 |
| 227 | ] |
| 228 | ); |
| 229 | |
| 230 | $this->add_control( |
| 231 | 'carousel_type', |
| 232 | [ |
| 233 | 'label' => esc_html__( 'Layout', 'wpr-addons' ), |
| 234 | 'type' => Controls_Manager::SELECT, |
| 235 | 'default' => 'coverflow', |
| 236 | 'separator' => 'before', |
| 237 | 'options' => [ |
| 238 | 'coverflow' => esc_html__( 'Cover Flow', 'wpr-addons' ), |
| 239 | 'carousel' => esc_html__( 'Carousel', 'wpr-addons' ), |
| 240 | 'flat' => esc_html__( 'Flat', 'wpr-addons' ) |
| 241 | ], |
| 242 | ] |
| 243 | ); |
| 244 | |
| 245 | $this->add_control( |
| 246 | 'starts_from_center', |
| 247 | [ |
| 248 | 'label' => __( 'Item Starts From Center', 'wpr-addons' ), |
| 249 | 'type' => Controls_Manager::SWITCHER, |
| 250 | 'return_value' => 'yes', |
| 251 | 'default' => 'yes', |
| 252 | ] |
| 253 | ); |
| 254 | |
| 255 | $this->add_controls_group_autoplay(); |
| 256 | |
| 257 | $this->add_control( |
| 258 | 'loop', |
| 259 | [ |
| 260 | 'label' => __( 'Loop', 'wpr-addons' ), |
| 261 | 'type' => Controls_Manager::SWITCHER, |
| 262 | 'return_value' => 'yes', |
| 263 | 'default' => 'yes', |
| 264 | ] |
| 265 | ); |
| 266 | |
| 267 | $this->add_control( |
| 268 | 'play_on_click', |
| 269 | [ |
| 270 | 'label' => __( 'Slide on Click', 'wpr-addons' ), |
| 271 | 'type' => Controls_Manager::SWITCHER, |
| 272 | 'return_value' => 'yes', |
| 273 | 'default' => 'yes', |
| 274 | ] |
| 275 | ); |
| 276 | |
| 277 | $this->add_control( |
| 278 | 'play_on_scroll', |
| 279 | [ |
| 280 | 'label' => __( 'Play on Scroll', 'wpr-addons' ), |
| 281 | 'type' => Controls_Manager::SWITCHER, |
| 282 | 'return_value' => 'yes', |
| 283 | 'default' => 'no', |
| 284 | ] |
| 285 | ); |
| 286 | |
| 287 | $this->add_responsive_control( |
| 288 | 'show_navigation', |
| 289 | [ |
| 290 | 'label' => __( 'Show Navigation', 'wpr-addons' ), |
| 291 | 'type' => Controls_Manager::SWITCHER, |
| 292 | 'default' => '', |
| 293 | 'widescreen_default' => 'yes', |
| 294 | 'laptop_default' => 'yes', |
| 295 | 'tablet_extra_default' => 'yes', |
| 296 | 'tablet_default' => 'yes', |
| 297 | 'mobile_extra_default' => 'yes', |
| 298 | 'mobile_default' => 'yes', |
| 299 | 'return_value' => 'yes', |
| 300 | 'separator' => 'before', |
| 301 | 'selectors_dictionary' => [ |
| 302 | '' => 'none', |
| 303 | 'yes' => 'flex' |
| 304 | ], |
| 305 | 'selectors' => [ |
| 306 | '{{WRAPPER}} .flipster__button' => 'display:{{VALUE}} !important;', |
| 307 | ], |
| 308 | 'render_type' => 'template', |
| 309 | ] |
| 310 | ); |
| 311 | |
| 312 | $this->add_control( |
| 313 | 'flip_carousel_nav_icon', |
| 314 | [ |
| 315 | 'label' => esc_html__( 'Navigation Icon', 'wpr-addons' ), |
| 316 | 'type' => 'wpr-arrow-icons', |
| 317 | 'default' => 'fas fa-angle', |
| 318 | 'condition' => [ |
| 319 | 'show_navigation' => 'yes' |
| 320 | ] |
| 321 | ] |
| 322 | ); |
| 323 | |
| 324 | $this->add_control( |
| 325 | 'show_pagination', |
| 326 | [ |
| 327 | 'label' => __( 'Show Pagination', 'wpr-addons' ), |
| 328 | 'type' => Controls_Manager::SWITCHER, |
| 329 | 'return_value' => 'yes', |
| 330 | 'separator' => 'before', |
| 331 | 'default' => '', |
| 332 | 'render_type' => 'template' |
| 333 | ] |
| 334 | ); |
| 335 | |
| 336 | $this->add_control( |
| 337 | 'pagination_position', |
| 338 | [ |
| 339 | 'label' => esc_html__( 'Pagination Position', 'wpr-addons' ), |
| 340 | 'type' => Controls_Manager::SELECT, |
| 341 | 'default' => 'after', |
| 342 | 'options' => [ |
| 343 | 'before' => esc_html__( 'Above Image', 'wpr-addons' ), |
| 344 | 'after' => esc_html__( 'Below Image', 'wpr-addons' ) |
| 345 | ], |
| 346 | 'render_type' => 'template', |
| 347 | 'prefix_class' => 'wpr-flip-pagination-', |
| 348 | 'condition' => [ |
| 349 | 'show_pagination' => 'yes' |
| 350 | ] |
| 351 | ] |
| 352 | ); |
| 353 | |
| 354 | $this->add_control( |
| 355 | 'enable_figcaption', |
| 356 | [ |
| 357 | 'label' => __( 'Show Image Caption', 'wpr-addons' ), |
| 358 | 'type' => Controls_Manager::SWITCHER, |
| 359 | 'return_value' => 'yes', |
| 360 | 'default' => '', |
| 361 | 'separator' => 'before' |
| 362 | ] |
| 363 | ); |
| 364 | |
| 365 | $this->add_control( |
| 366 | 'enable_subcaption', |
| 367 | [ |
| 368 | 'label' => __( 'Show subcaption', 'wpr-addons' ), |
| 369 | 'type' => Controls_Manager::SWITCHER, |
| 370 | 'return_value' => 'yes', |
| 371 | 'default' => '', |
| 372 | 'condition' => [ |
| 373 | 'enable_figcaption' => 'yes' |
| 374 | ] |
| 375 | ] |
| 376 | ); |
| 377 | |
| 378 | $this->add_control( |
| 379 | 'flipcaption_position', |
| 380 | [ |
| 381 | 'label' => esc_html__( 'Position', 'wpr-addons' ), |
| 382 | 'type' => Controls_Manager::SELECT, |
| 383 | 'default' => 'after', |
| 384 | 'options' => [ |
| 385 | 'before' => esc_html__( 'Above Image', 'wpr-addons' ), |
| 386 | 'after' => esc_html__( 'Below Image', 'wpr-addons' ), |
| 387 | ], |
| 388 | 'condition' => [ |
| 389 | 'enable_figcaption' => 'yes' |
| 390 | ] |
| 391 | ] |
| 392 | ); |
| 393 | |
| 394 | $this->end_controls_section(); |
| 395 | |
| 396 | // Section: Request New Feature |
| 397 | Utilities::wpr_add_section_request_feature( $this, Controls_Manager::RAW_HTML, '' ); |
| 398 | |
| 399 | // Section: Pro Features |
| 400 | Utilities::pro_features_list_section( $this, '', Controls_Manager::RAW_HTML, 'flip-carousel', [ |
| 401 | 'Add Unlimited Slides', |
| 402 | 'Slider Autoplay options', |
| 403 | ] ); |
| 404 | |
| 405 | $this->start_controls_section( |
| 406 | 'section_flip_carousel_navigation_styles', |
| 407 | [ |
| 408 | 'label' => esc_html__( 'Navigation', 'wpr-addons' ), |
| 409 | 'tab' => Controls_Manager::TAB_STYLE, |
| 410 | 'condition' => [ |
| 411 | 'show_navigation' => 'yes' |
| 412 | ] |
| 413 | ] |
| 414 | ); |
| 415 | |
| 416 | $this->start_controls_tabs( |
| 417 | 'style_tabs_navigation' |
| 418 | ); |
| 419 | |
| 420 | $this->start_controls_tab( |
| 421 | 'navigation_style_normal_tab', |
| 422 | [ |
| 423 | 'label' => __( 'Normal', 'wpr-addons' ), |
| 424 | ] |
| 425 | ); |
| 426 | |
| 427 | $this->add_control( |
| 428 | 'icon_color', |
| 429 | [ |
| 430 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 431 | 'type' => Controls_Manager::COLOR, |
| 432 | 'default' => '#FFF', |
| 433 | 'selectors' => [ |
| 434 | '{{WRAPPER}} .flipster__button i' => 'color: {{VALUE}}', |
| 435 | '{{WRAPPER}} .flipster__button svg' => 'fill: {{VALUE}}' |
| 436 | ] |
| 437 | ] |
| 438 | ); |
| 439 | |
| 440 | $this->add_control( |
| 441 | 'icon_bg_color', |
| 442 | [ |
| 443 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 444 | 'type' => Controls_Manager::COLOR, |
| 445 | 'default' => '#605BE5', |
| 446 | 'selectors' => [ |
| 447 | '{{WRAPPER}} .flipster__button' => 'background-color: {{VALUE}}', |
| 448 | ], |
| 449 | ] |
| 450 | ); |
| 451 | |
| 452 | $this->add_control( |
| 453 | 'navigation_border_color', |
| 454 | [ |
| 455 | 'label' => esc_html__( 'Border Color', 'wpr-addons' ), |
| 456 | 'type' => Controls_Manager::COLOR, |
| 457 | 'default' => '', |
| 458 | 'selectors' => [ |
| 459 | '{{WRAPPER}} .flipster__button' => 'border-color: {{VALUE}}', |
| 460 | ] |
| 461 | ] |
| 462 | ); |
| 463 | |
| 464 | $this->add_group_control( |
| 465 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 466 | [ |
| 467 | 'name' => 'box_shadow_navigation', |
| 468 | 'label' => __( 'Box Shadow', 'wpr-addons' ), |
| 469 | 'selector' => '{{WRAPPER}} .flipster__button', |
| 470 | ] |
| 471 | ); |
| 472 | |
| 473 | $this->add_control( |
| 474 | 'navigation_transition', |
| 475 | [ |
| 476 | 'label' => esc_html__( 'Transition', 'wpr-addons' ), |
| 477 | 'type' => Controls_Manager::NUMBER, |
| 478 | 'default' => 1, |
| 479 | 'min' => 0, |
| 480 | 'max' => 5, |
| 481 | 'step' => 0.1, |
| 482 | 'selectors' => [ |
| 483 | '{{WRAPPER}} .flipster__button' => '-webkit-transition: all {{VALUE}}s ease; transition: all {{VALUE}}s ease;', |
| 484 | '{{WRAPPER}} .flipster__button i' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 485 | '{{WRAPPER}} .flipster__button svg' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;' |
| 486 | ], |
| 487 | ] |
| 488 | ); |
| 489 | |
| 490 | $this->end_controls_tab(); |
| 491 | |
| 492 | $this->start_controls_tab( |
| 493 | 'navigation_style_hover_tab', |
| 494 | [ |
| 495 | 'label' => __( 'Hover', 'wpr-addons' ), |
| 496 | ] |
| 497 | ); |
| 498 | |
| 499 | $this->add_control( |
| 500 | 'navigation_icon_color_hover', |
| 501 | [ |
| 502 | 'label' => esc_html__( 'Icon Color', 'wpr-addons' ), |
| 503 | 'type' => Controls_Manager::COLOR, |
| 504 | 'default' => '', |
| 505 | 'selectors' => [ |
| 506 | '{{WRAPPER}} .flipster__button:hover i' => 'color: {{VALUE}}', |
| 507 | '{{WRAPPER}} .flipster__button:hover svg' => 'fill: {{VALUE}}' |
| 508 | ] |
| 509 | ] |
| 510 | ); |
| 511 | |
| 512 | $this->add_control( |
| 513 | 'navigation_bg_color_hover', |
| 514 | [ |
| 515 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 516 | 'type' => Controls_Manager::COLOR, |
| 517 | 'default' => '#423EC0', |
| 518 | 'selectors' => [ |
| 519 | '{{WRAPPER}} .flipster__button:hover' => 'background-color: {{VALUE}}', |
| 520 | ], |
| 521 | ] |
| 522 | ); |
| 523 | |
| 524 | $this->add_control( |
| 525 | 'navigation_border_color_hover', |
| 526 | [ |
| 527 | 'label' => esc_html__( 'Border Color', 'wpr-addons' ), |
| 528 | 'type' => Controls_Manager::COLOR, |
| 529 | 'default' => '', |
| 530 | 'selectors' => [ |
| 531 | '{{WRAPPER}} .flipster__button:hover' => 'border-color: {{VALUE}}', |
| 532 | ] |
| 533 | ] |
| 534 | ); |
| 535 | |
| 536 | $this->add_group_control( |
| 537 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 538 | [ |
| 539 | 'name' => 'box_shadow_navigation_hover', |
| 540 | 'label' => __( 'Box Shadow', 'wpr-addons' ), |
| 541 | 'selector' => '{{WRAPPER}} .flipster__button:hover', |
| 542 | ] |
| 543 | ); |
| 544 | |
| 545 | $this->end_controls_tab(); |
| 546 | |
| 547 | $this->end_controls_tabs(); |
| 548 | |
| 549 | $this->add_responsive_control( |
| 550 | 'icon_size', |
| 551 | [ |
| 552 | 'type' => Controls_Manager::SLIDER, |
| 553 | 'label' => esc_html__( 'Icon Size', 'wpr-addons' ), |
| 554 | 'size_units' => [ 'px' ], |
| 555 | 'range' => [ |
| 556 | 'px' => [ |
| 557 | 'min' => 0, |
| 558 | 'max' => 200, |
| 559 | ] |
| 560 | ], |
| 561 | 'default' => [ |
| 562 | 'unit' => 'px', |
| 563 | 'size' => 20, |
| 564 | ], |
| 565 | 'selectors' => [ |
| 566 | '{{WRAPPER}} .flipster__button i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 567 | '{{WRAPPER}} .flipster__button svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 568 | ], |
| 569 | 'separator' => 'before' |
| 570 | ] |
| 571 | ); |
| 572 | |
| 573 | $this->add_responsive_control( |
| 574 | 'icon_bg_size', |
| 575 | [ |
| 576 | 'type' => Controls_Manager::SLIDER, |
| 577 | 'label' => esc_html__( 'Box Size', 'wpr-addons' ), |
| 578 | 'size_units' => [ 'px' ], |
| 579 | 'range' => [ |
| 580 | 'px' => [ |
| 581 | 'min' => 0, |
| 582 | 'max' => 150, |
| 583 | ] |
| 584 | ], |
| 585 | 'default' => [ |
| 586 | 'unit' => 'px', |
| 587 | 'size' => 35, |
| 588 | ], |
| 589 | 'selectors' => [ |
| 590 | '{{WRAPPER}} .flipster__button' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 591 | ] |
| 592 | ] |
| 593 | ); |
| 594 | |
| 595 | $this->add_control( |
| 596 | 'border', |
| 597 | [ |
| 598 | 'label' => esc_html__( 'Border Type', 'wpr-addons' ), |
| 599 | 'type' => Controls_Manager::SELECT, |
| 600 | 'options' => [ |
| 601 | 'none' => esc_html__( 'None', 'wpr-addons' ), |
| 602 | 'solid' => esc_html__( 'Solid', 'wpr-addons' ), |
| 603 | 'double' => esc_html__( 'Double', 'wpr-addons' ), |
| 604 | 'dotted' => esc_html__( 'Dotted', 'wpr-addons' ), |
| 605 | 'dashed' => esc_html__( 'Dashed', 'wpr-addons' ), |
| 606 | 'groove' => esc_html__( 'Groove', 'wpr-addons' ), |
| 607 | ], |
| 608 | 'default' => 'none', |
| 609 | 'selectors' => [ |
| 610 | '{{WRAPPER}} button.flipster__button' => 'border-style: {{VALUE}};', |
| 611 | ], |
| 612 | 'separator' => 'before' |
| 613 | ] |
| 614 | ); |
| 615 | |
| 616 | $this->add_control( |
| 617 | 'icon_border_width', |
| 618 | [ |
| 619 | 'type' => Controls_Manager::DIMENSIONS, |
| 620 | 'label' => esc_html__( 'Border Width', 'wpr-addons' ), |
| 621 | 'size_units' => [ 'px', '%' ], |
| 622 | 'range' => [ |
| 623 | 'px' => [ |
| 624 | 'min' => 0, |
| 625 | 'max' => 150, |
| 626 | ], |
| 627 | '%' => [ |
| 628 | 'min' => 0, |
| 629 | 'max' => 100, |
| 630 | ] |
| 631 | ], |
| 632 | 'default' => [ |
| 633 | 'top' => 1, |
| 634 | 'right' => 1, |
| 635 | 'bottom' => 1, |
| 636 | 'left' => 1, |
| 637 | 'unit' => 'px' |
| 638 | ], |
| 639 | 'selectors' => [ |
| 640 | '{{WRAPPER}} button.flipster__button' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 641 | ], |
| 642 | 'condition' => [ |
| 643 | 'border!' => 'none' |
| 644 | ] |
| 645 | ] |
| 646 | ); |
| 647 | |
| 648 | $this->add_control( |
| 649 | 'icon_border_radius', |
| 650 | [ |
| 651 | 'type' => Controls_Manager::DIMENSIONS, |
| 652 | 'label' => esc_html__( 'Border Radius', 'wpr-addons' ), |
| 653 | 'size_units' => [ 'px', '%' ], |
| 654 | 'range' => [ |
| 655 | 'px' => [ |
| 656 | 'min' => 0, |
| 657 | 'max' => 150, |
| 658 | ], |
| 659 | '%' => [ |
| 660 | 'min' => 0, |
| 661 | 'max' => 100, |
| 662 | ] |
| 663 | ], |
| 664 | 'default' => [ |
| 665 | 'top' => 0, |
| 666 | 'right' => 0, |
| 667 | 'bottom' => 0, |
| 668 | 'left' => 0, |
| 669 | 'unit' => 'px' |
| 670 | ], |
| 671 | 'selectors' => [ |
| 672 | '{{WRAPPER}} button.flipster__button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 673 | ] |
| 674 | ] |
| 675 | ); |
| 676 | |
| 677 | $this->end_controls_section(); |
| 678 | |
| 679 | $this->start_controls_section( |
| 680 | 'section_flip_carousel_pagination_styles', |
| 681 | [ |
| 682 | 'label' => esc_html__( 'Pagination', 'wpr-addons' ), |
| 683 | 'tab' => Controls_Manager::TAB_STYLE, |
| 684 | 'condition' => [ |
| 685 | 'show_pagination' => 'yes' |
| 686 | ] |
| 687 | ] |
| 688 | ); |
| 689 | |
| 690 | $this->start_controls_tabs( |
| 691 | 'style_tabs_pagination' |
| 692 | ); |
| 693 | |
| 694 | $this->start_controls_tab( |
| 695 | 'pagination_style_normal_tab', |
| 696 | [ |
| 697 | 'label' => __( 'Normal', 'wpr-addons' ), |
| 698 | ] |
| 699 | ); |
| 700 | |
| 701 | $this->add_control( |
| 702 | 'pagination_color', |
| 703 | [ |
| 704 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 705 | 'type' => Controls_Manager::COLOR, |
| 706 | 'default' => '#fff', |
| 707 | 'selectors' => [ |
| 708 | '{{WRAPPER}} .flipster__nav__item .flipster__nav__link' => 'color: {{VALUE}}', |
| 709 | ], |
| 710 | ] |
| 711 | ); |
| 712 | |
| 713 | $this->add_control( |
| 714 | 'pagination_bg_color', |
| 715 | [ |
| 716 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 717 | 'type' => Controls_Manager::COLOR, |
| 718 | 'default' => '#8D8AE1', |
| 719 | 'selectors' => [ |
| 720 | '{{WRAPPER}} .flipster__nav__item' => 'background-color: {{VALUE}}', |
| 721 | ], |
| 722 | ] |
| 723 | ); |
| 724 | |
| 725 | $this->add_control( |
| 726 | 'pagination_border_color', |
| 727 | [ |
| 728 | 'label' => esc_html__( 'Border Color', 'wpr-addons' ), |
| 729 | 'type' => Controls_Manager::COLOR, |
| 730 | 'default' => '#DDDDDD', |
| 731 | 'selectors' => [ |
| 732 | '{{WRAPPER}} .flipster__nav__item' => 'border-color: {{VALUE}}' |
| 733 | ] |
| 734 | ] |
| 735 | ); |
| 736 | |
| 737 | $this->add_group_control( |
| 738 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 739 | [ |
| 740 | 'name' => 'box_shadow_pagination', |
| 741 | 'label' => __( 'Box Shadow', 'wpr-addons' ), |
| 742 | 'selector' => '{{WRAPPER}} .flipster__nav__item', |
| 743 | ] |
| 744 | ); |
| 745 | |
| 746 | $this->add_group_control( |
| 747 | Group_Control_Typography::get_type(), |
| 748 | [ |
| 749 | 'name' => 'pagination_content_typography', |
| 750 | 'label' => __( 'Typography', 'wpr-addons' ), |
| 751 | 'selector' => '{{WRAPPER}} .flipster__nav__link', |
| 752 | 'fields_options' => [ |
| 753 | 'typography' => [ |
| 754 | 'default' => 'custom', |
| 755 | ], |
| 756 | 'font_weight' => [ |
| 757 | 'default' => '400', |
| 758 | ], |
| 759 | 'font_family' => [ |
| 760 | 'default' => 'Roboto', |
| 761 | ], |
| 762 | 'font_size' => [ |
| 763 | 'default' => [ |
| 764 | 'size' => '14', |
| 765 | 'unit' => 'px', |
| 766 | ] |
| 767 | ] |
| 768 | ] |
| 769 | ] |
| 770 | ); |
| 771 | |
| 772 | $this->add_control( |
| 773 | 'pagination_transition', |
| 774 | [ |
| 775 | 'label' => esc_html__( 'Transition', 'wpr-addons' ), |
| 776 | 'type' => Controls_Manager::NUMBER, |
| 777 | 'default' => 1, |
| 778 | 'min' => 0, |
| 779 | 'max' => 5, |
| 780 | 'step' => 0.1, |
| 781 | 'selectors' => [ |
| 782 | '{{WRAPPER}} .flipster__nav__item .flipster__nav__link' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 783 | '{{WRAPPER}} .flipster__nav__item' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 784 | '{{WRAPPER}} .flipster__nav__item i' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 785 | '{{WRAPPER}} .flipster__nav__item svg' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 786 | ], |
| 787 | ] |
| 788 | ); |
| 789 | |
| 790 | $this->end_controls_tab(); |
| 791 | |
| 792 | $this->start_controls_tab( |
| 793 | 'pagination_style_hover_tab', |
| 794 | [ |
| 795 | 'label' => __( 'Hover', 'wpr-addons' ), |
| 796 | ] |
| 797 | ); |
| 798 | |
| 799 | $this->add_control( |
| 800 | 'pagination_color_hover', |
| 801 | [ |
| 802 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 803 | 'type' => Controls_Manager::COLOR, |
| 804 | 'default' => '#DDDDDD', |
| 805 | 'selectors' => [ |
| 806 | '{{WRAPPER}} .flipster__nav__item .flipster__nav__link:hover' => 'color: {{VALUE}}', |
| 807 | '{{WRAPPER}} .flipster__nav__item--current .flipster__nav__link' => 'color: {{VALUE}}', |
| 808 | ], |
| 809 | ] |
| 810 | ); |
| 811 | |
| 812 | $this->add_control( |
| 813 | 'pagination_bg_color_hover', |
| 814 | [ |
| 815 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 816 | 'type' => Controls_Manager::COLOR, |
| 817 | 'default' => '#605BE5', |
| 818 | 'selectors' => [ |
| 819 | '{{WRAPPER}} .flipster__nav__item:hover' => 'background-color: {{VALUE}}', |
| 820 | '{{WRAPPER}} .flipster__nav__item--current' => 'background-color: {{VALUE}} !important', |
| 821 | ], |
| 822 | 'render_type' => 'template' |
| 823 | ] |
| 824 | ); |
| 825 | |
| 826 | $this->add_control( |
| 827 | 'pagination_border_color_hover', |
| 828 | [ |
| 829 | 'label' => esc_html__( 'Border Color', 'wpr-addons' ), |
| 830 | 'type' => Controls_Manager::COLOR, |
| 831 | 'default' => '#DDDDDD', |
| 832 | 'selectors' => [ |
| 833 | '{{WRAPPER}} .flipster__nav__item:hover' => 'border-color: {{VALUE}}' |
| 834 | ] |
| 835 | ] |
| 836 | ); |
| 837 | |
| 838 | $this->add_group_control( |
| 839 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 840 | [ |
| 841 | 'name' => 'box_shadow_pagination_hover', |
| 842 | 'label' => __( 'Box Shadow', 'wpr-addons' ), |
| 843 | 'selector' => '{{WRAPPER}} .flipster__nav__item:hover', |
| 844 | ] |
| 845 | ); |
| 846 | |
| 847 | $this->end_controls_tab(); |
| 848 | |
| 849 | $this->end_controls_tabs(); |
| 850 | |
| 851 | $this->add_responsive_control( |
| 852 | 'pagination_size', |
| 853 | [ |
| 854 | 'type' => Controls_Manager::SLIDER, |
| 855 | 'label' => esc_html__( 'Box Size', 'wpr-addons' ), |
| 856 | 'size_units' => [ 'px' ], |
| 857 | 'range' => [ |
| 858 | 'px' => [ |
| 859 | 'min' => 0, |
| 860 | 'max' => 150, |
| 861 | ] |
| 862 | ], |
| 863 | 'default' => [ |
| 864 | 'unit' => 'px', |
| 865 | 'size' => 35, |
| 866 | ], |
| 867 | 'selectors' => [ |
| 868 | '{{WRAPPER}} .flipster__nav__item' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 869 | '{{WRAPPER}} .flipster__nav__link::after' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 870 | ], |
| 871 | 'separator' => 'before', |
| 872 | 'condition' => [ |
| 873 | 'show_pagination' => 'yes' |
| 874 | ] |
| 875 | ] |
| 876 | ); |
| 877 | |
| 878 | $this->add_responsive_control( |
| 879 | 'pagination_gutter', |
| 880 | [ |
| 881 | 'type' => Controls_Manager::SLIDER, |
| 882 | 'label' => esc_html__( 'Gutter', 'wpr-addons' ), |
| 883 | 'size_units' => [ 'px' ], |
| 884 | 'range' => [ |
| 885 | 'px' => [ |
| 886 | 'min' => 0, |
| 887 | 'max' => 100, |
| 888 | ] |
| 889 | ], |
| 890 | 'default' => [ |
| 891 | 'unit' => 'px', |
| 892 | 'size' => 3, |
| 893 | ], |
| 894 | 'selectors' => [ |
| 895 | '{{WRAPPER}} .wpr-flip-carousel .flipster__nav__item' => 'margin: 0 {{SIZE}}{{UNIT}};', |
| 896 | ] |
| 897 | ] |
| 898 | ); |
| 899 | |
| 900 | $this->add_responsive_control( |
| 901 | 'pagination_margin', |
| 902 | [ |
| 903 | 'type' => Controls_Manager::SLIDER, |
| 904 | 'label' => esc_html__( 'Vertical Distance', 'wpr-addons' ), |
| 905 | 'size_units' => [ 'px', '%' ], |
| 906 | 'range' => [ |
| 907 | 'px' => [ |
| 908 | 'min' => -50, |
| 909 | 'max' => 50, |
| 910 | ] |
| 911 | ], |
| 912 | 'default' => [ |
| 913 | 'unit' => 'px', |
| 914 | 'size' => 3, |
| 915 | ], |
| 916 | 'selectors' => [ |
| 917 | '{{WRAPPER}}.wpr-flip-pagination-after .wpr-flip-carousel .flipster__nav' => 'margin-top: {{SIZE}}{{UNIT}};', |
| 918 | '{{WRAPPER}}.wpr-flip-pagination-before .wpr-flip-carousel .flipster__nav' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 919 | '{{WRAPPER}} .flipster__button' => 'top: calc(50% - {{SIZE}}{{UNIT}});' |
| 920 | ], |
| 921 | ] |
| 922 | ); |
| 923 | |
| 924 | $this->add_control( |
| 925 | 'pagination_border', |
| 926 | [ |
| 927 | 'label' => esc_html__( 'Border Type', 'wpr-addons' ), |
| 928 | 'type' => Controls_Manager::SELECT, |
| 929 | 'options' => [ |
| 930 | 'none' => esc_html__( 'None', 'wpr-addons' ), |
| 931 | 'solid' => esc_html__( 'Solid', 'wpr-addons' ), |
| 932 | 'double' => esc_html__( 'Double', 'wpr-addons' ), |
| 933 | 'dotted' => esc_html__( 'Dotted', 'wpr-addons' ), |
| 934 | 'dashed' => esc_html__( 'Dashed', 'wpr-addons' ), |
| 935 | 'groove' => esc_html__( 'Groove', 'wpr-addons' ), |
| 936 | ], |
| 937 | 'default' => 'none', |
| 938 | 'selectors' => [ |
| 939 | '{{WRAPPER}} .flipster__nav__item' => 'border-style: {{VALUE}};', |
| 940 | ], |
| 941 | 'separator' => 'before' |
| 942 | ] |
| 943 | ); |
| 944 | |
| 945 | $this->add_control( |
| 946 | 'pagination_border_width', |
| 947 | [ |
| 948 | 'type' => Controls_Manager::DIMENSIONS, |
| 949 | 'label' => esc_html__( 'Border Width', 'wpr-addons' ), |
| 950 | 'size_units' => [ 'px', '%' ], |
| 951 | 'range' => [ |
| 952 | 'px' => [ |
| 953 | 'min' => 0, |
| 954 | 'max' => 150, |
| 955 | ], |
| 956 | '%' => [ |
| 957 | 'min' => 0, |
| 958 | 'max' => 100, |
| 959 | ] |
| 960 | ], |
| 961 | 'default' => [ |
| 962 | 'top' => 1, |
| 963 | 'right' => 1, |
| 964 | 'bottom' => 1, |
| 965 | 'left' => 1, |
| 966 | 'unit' => 'px' |
| 967 | ], |
| 968 | 'selectors' => [ |
| 969 | '{{WRAPPER}} .flipster__nav__item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 970 | '{{WRAPPER}} .flipster__nav__link::after' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 971 | ], |
| 972 | 'condition' => [ |
| 973 | 'pagination_border!' => 'none' |
| 974 | ], |
| 975 | ] |
| 976 | ); |
| 977 | |
| 978 | $this->add_control( |
| 979 | 'pagination_border_radius', |
| 980 | [ |
| 981 | 'type' => Controls_Manager::DIMENSIONS, |
| 982 | 'label' => esc_html__( 'Border Radius', 'wpr-addons' ), |
| 983 | 'size_units' => [ 'px', '%' ], |
| 984 | 'range' => [ |
| 985 | 'px' => [ |
| 986 | 'min' => 0, |
| 987 | 'max' => 150, |
| 988 | ], |
| 989 | '%' => [ |
| 990 | 'min' => 0, |
| 991 | 'max' => 100, |
| 992 | ] |
| 993 | ], |
| 994 | 'default' => [ |
| 995 | 'top' => 0, |
| 996 | 'right' => 0, |
| 997 | 'bottom' => 0, |
| 998 | 'left' => 0, |
| 999 | 'unit' => 'px' |
| 1000 | ], |
| 1001 | 'selectors' => [ |
| 1002 | '{{WRAPPER}} .flipster__nav__item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1003 | '{{WRAPPER}} .flipster__nav__link::after' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1004 | ] |
| 1005 | ] |
| 1006 | ); |
| 1007 | |
| 1008 | $this->end_controls_section(); |
| 1009 | |
| 1010 | $this->start_controls_section( |
| 1011 | 'section_flip_carousel_caption_styles', |
| 1012 | [ |
| 1013 | 'label' => esc_html__( 'Caption', 'wpr-addons' ), |
| 1014 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1015 | 'condition' => [ |
| 1016 | 'enable_figcaption' => 'yes' |
| 1017 | ] |
| 1018 | ] |
| 1019 | ); |
| 1020 | |
| 1021 | $this->start_controls_tabs( 'caption_style_tabs' ); |
| 1022 | |
| 1023 | $this->start_controls_tab( |
| 1024 | 'caption_style_tabs_normal', |
| 1025 | [ |
| 1026 | 'label' => esc_html__( 'Normal', 'wpr-addons' ), |
| 1027 | ] |
| 1028 | ); |
| 1029 | |
| 1030 | $this->add_control( |
| 1031 | 'caption_color', |
| 1032 | [ |
| 1033 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 1034 | 'type' => Controls_Manager::COLOR, |
| 1035 | 'default' => '#000', |
| 1036 | 'selectors' => [ |
| 1037 | '{{WRAPPER}} .flipcaption' => 'color: {{VALUE}}', |
| 1038 | ], |
| 1039 | ] |
| 1040 | ); |
| 1041 | |
| 1042 | $this->add_control( |
| 1043 | 'caption_background_color', |
| 1044 | [ |
| 1045 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 1046 | 'type' => Controls_Manager::COLOR, |
| 1047 | 'default' => '#FFF', |
| 1048 | 'selectors' => [ |
| 1049 | '{{WRAPPER}} .flipcaption' => 'background-color: {{VALUE}}', |
| 1050 | ], |
| 1051 | ] |
| 1052 | ); |
| 1053 | |
| 1054 | $this->add_group_control( |
| 1055 | Group_Control_Typography::get_type(), |
| 1056 | [ |
| 1057 | 'name' => 'content_typography_caption', |
| 1058 | 'label' => __( 'Typography', 'wpr-addons' ), |
| 1059 | 'selector' => '{{WRAPPER}} .flipcaption', |
| 1060 | 'fields_options' => [ |
| 1061 | 'typography' => [ |
| 1062 | 'default' => 'custom', |
| 1063 | ], |
| 1064 | 'font_weight' => [ |
| 1065 | 'default' => '400', |
| 1066 | ], |
| 1067 | 'font_family' => [ |
| 1068 | 'default' => 'Roboto', |
| 1069 | ], |
| 1070 | 'font_style' => [ |
| 1071 | 'default' => 'normal' |
| 1072 | ], |
| 1073 | 'font_size' => [ |
| 1074 | 'default' => [ |
| 1075 | 'size' => '14', |
| 1076 | 'unit' => 'px', |
| 1077 | ] |
| 1078 | ] |
| 1079 | ] |
| 1080 | ] |
| 1081 | ); |
| 1082 | |
| 1083 | $this->add_control( |
| 1084 | 'caption_transition', |
| 1085 | [ |
| 1086 | 'label' => esc_html__( 'Transition', 'wpr-addons' ), |
| 1087 | 'type' => Controls_Manager::NUMBER, |
| 1088 | 'default' => 0.4, |
| 1089 | 'min' => 0, |
| 1090 | 'max' => 5, |
| 1091 | 'step' => 0.1, |
| 1092 | 'selectors' => [ |
| 1093 | '{{WRAPPER}} .flipcaption' => '-webkit-transition: all {{VALUE}}s ease !important; transition: all {{VALUE}}s ease !important;', |
| 1094 | ] |
| 1095 | ] |
| 1096 | ); |
| 1097 | |
| 1098 | $this->end_controls_tab(); |
| 1099 | |
| 1100 | $this->start_controls_tab( |
| 1101 | 'caption_style_tabs_hover', |
| 1102 | [ |
| 1103 | 'label' => esc_html__( 'Hover', 'wpr-addons' ), |
| 1104 | ] |
| 1105 | ); |
| 1106 | |
| 1107 | $this->add_control( |
| 1108 | 'caption_color_hover', |
| 1109 | [ |
| 1110 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 1111 | 'type' => Controls_Manager::COLOR, |
| 1112 | 'default' => '', |
| 1113 | 'selectors' => [ |
| 1114 | '{{WRAPPER}} .flipcaption:hover' => 'color: {{VALUE}}', |
| 1115 | ], |
| 1116 | ] |
| 1117 | ); |
| 1118 | |
| 1119 | $this->end_controls_tab(); |
| 1120 | |
| 1121 | $this->end_controls_tabs(); |
| 1122 | |
| 1123 | $this->add_responsive_control( |
| 1124 | 'flipcaption_padding', |
| 1125 | [ |
| 1126 | 'label' => esc_html__( 'Padding', 'wpr-addons' ), |
| 1127 | 'type' => Controls_Manager::DIMENSIONS, |
| 1128 | 'default' => [ |
| 1129 | 'top' => 10, |
| 1130 | 'right' => 0, |
| 1131 | 'bottom' => 10, |
| 1132 | 'left' => 0, |
| 1133 | ], |
| 1134 | 'size_units' => [ 'px', '%' ], |
| 1135 | 'selectors' => [ |
| 1136 | '{{WRAPPER}} .flipcaption span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1137 | ], |
| 1138 | 'separator' => 'before' |
| 1139 | ] |
| 1140 | ); |
| 1141 | |
| 1142 | $this->add_responsive_control( |
| 1143 | 'flipcaption_alignment', |
| 1144 | [ |
| 1145 | 'label' => esc_html__( 'Alignment', 'wpr-addons' ), |
| 1146 | 'type' => Controls_Manager::CHOOSE, |
| 1147 | 'label_block' => false, |
| 1148 | 'default' => 'center', |
| 1149 | 'separator' => 'before', |
| 1150 | 'options' => [ |
| 1151 | 'left' => [ |
| 1152 | 'title' => esc_html__( 'Left', 'wpr-addons' ), |
| 1153 | 'icon' => 'eicon-text-align-left', |
| 1154 | ], |
| 1155 | 'center' => [ |
| 1156 | 'title' => esc_html__( 'Center', 'wpr-addons' ), |
| 1157 | 'icon' => 'eicon-text-align-center', |
| 1158 | ], |
| 1159 | 'right' => [ |
| 1160 | 'title' => esc_html__( 'Right', 'wpr-addons' ), |
| 1161 | 'icon' => 'eicon-text-align-right', |
| 1162 | ], |
| 1163 | ], |
| 1164 | 'selectors' => [ |
| 1165 | '{{WRAPPER}} .flipcaption' => 'text-align: {{VALUE}};', |
| 1166 | ] |
| 1167 | ] |
| 1168 | ); |
| 1169 | |
| 1170 | $this->end_controls_section(); |
| 1171 | |
| 1172 | $this->start_controls_section( |
| 1173 | 'section_flip_carousel_subcaption_styles', |
| 1174 | [ |
| 1175 | 'label' => esc_html__( 'Subcaption', 'wpr-addons' ), |
| 1176 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1177 | 'condition' => [ |
| 1178 | 'enable_subcaption' => 'yes' |
| 1179 | ] |
| 1180 | ] |
| 1181 | ); |
| 1182 | |
| 1183 | $this->add_control( |
| 1184 | 'subcaption_color', |
| 1185 | [ |
| 1186 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 1187 | 'type' => Controls_Manager::COLOR, |
| 1188 | 'default' => '#777777', |
| 1189 | 'selectors' => [ |
| 1190 | '{{WRAPPER}} .subcaption' => 'color: {{VALUE}}', |
| 1191 | ], |
| 1192 | ] |
| 1193 | ); |
| 1194 | |
| 1195 | $this->add_control( |
| 1196 | 'subcaption_background_color', |
| 1197 | [ |
| 1198 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 1199 | 'type' => Controls_Manager::COLOR, |
| 1200 | 'default' => '#FFF', |
| 1201 | 'selectors' => [ |
| 1202 | '{{WRAPPER}} .subcaption' => 'background-color: {{VALUE}}', |
| 1203 | ], |
| 1204 | ] |
| 1205 | ); |
| 1206 | |
| 1207 | $this->add_group_control( |
| 1208 | Group_Control_Typography::get_type(), |
| 1209 | [ |
| 1210 | 'name' => 'content_typography_subcaption', |
| 1211 | 'label' => __( 'Typography', 'wpr-addons' ), |
| 1212 | 'selector' => '{{WRAPPER}} .subcaption', |
| 1213 | 'fields_options' => [ |
| 1214 | 'typography' => [ |
| 1215 | 'default' => 'custom', |
| 1216 | ], |
| 1217 | 'font_weight' => [ |
| 1218 | 'default' => '', |
| 1219 | ], |
| 1220 | 'font_family' => [ |
| 1221 | 'default' => 'Roboto', |
| 1222 | ], |
| 1223 | 'font_style' => [ |
| 1224 | 'default' => 'normal' |
| 1225 | ], |
| 1226 | 'font_size' => [ |
| 1227 | 'default' => [ |
| 1228 | 'size' => '12', |
| 1229 | 'unit' => 'px', |
| 1230 | ] |
| 1231 | ] |
| 1232 | ] |
| 1233 | ] |
| 1234 | ); |
| 1235 | |
| 1236 | $this->add_responsive_control( |
| 1237 | 'subcaption_padding', |
| 1238 | [ |
| 1239 | 'label' => esc_html__( 'Padding', 'wpr-addons' ), |
| 1240 | 'type' => Controls_Manager::DIMENSIONS, |
| 1241 | 'default' => [ |
| 1242 | 'top' => 10, |
| 1243 | 'right' => 0, |
| 1244 | 'bottom' => 10, |
| 1245 | 'left' => 0, |
| 1246 | ], |
| 1247 | 'size_units' => [ 'px', '%' ], |
| 1248 | 'selectors' => [ |
| 1249 | '{{WRAPPER}} .subcaption span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1250 | ], |
| 1251 | 'separator' => 'before' |
| 1252 | ] |
| 1253 | ); |
| 1254 | |
| 1255 | $this->add_responsive_control( |
| 1256 | 'subcaption_margin', |
| 1257 | [ |
| 1258 | 'label' => esc_html__( 'Margin', 'wpr-addons' ), |
| 1259 | 'type' => Controls_Manager::DIMENSIONS, |
| 1260 | 'default' => [ |
| 1261 | 'top' => 0, |
| 1262 | 'right' => 0, |
| 1263 | 'bottom' => 0, |
| 1264 | 'left' => 0, |
| 1265 | ], |
| 1266 | 'size_units' => [ 'px', '%' ], |
| 1267 | 'selectors' => [ |
| 1268 | '{{WRAPPER}} .subcaption span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1269 | ] |
| 1270 | ] |
| 1271 | ); |
| 1272 | |
| 1273 | $this->add_responsive_control( |
| 1274 | 'subcaption_alignment', |
| 1275 | [ |
| 1276 | 'label' => esc_html__( 'Alignment', 'wpr-addons' ), |
| 1277 | 'type' => Controls_Manager::CHOOSE, |
| 1278 | 'label_block' => false, |
| 1279 | 'default' => 'center', |
| 1280 | 'separator' => 'before', |
| 1281 | 'options' => [ |
| 1282 | 'left' => [ |
| 1283 | 'title' => esc_html__( 'Left', 'wpr-addons' ), |
| 1284 | 'icon' => 'eicon-text-align-left', |
| 1285 | ], |
| 1286 | 'center' => [ |
| 1287 | 'title' => esc_html__( 'Center', 'wpr-addons' ), |
| 1288 | 'icon' => 'eicon-text-align-center', |
| 1289 | ], |
| 1290 | 'right' => [ |
| 1291 | 'title' => esc_html__( 'Right', 'wpr-addons' ), |
| 1292 | 'icon' => 'eicon-text-align-right', |
| 1293 | ], |
| 1294 | ], |
| 1295 | 'selectors' => [ |
| 1296 | '{{WRAPPER}} .subcaption' => 'text-align: {{VALUE}};', |
| 1297 | ] |
| 1298 | ] |
| 1299 | ); |
| 1300 | |
| 1301 | $this->end_controls_section(); |
| 1302 | } |
| 1303 | |
| 1304 | public function flip_carousel_attributes($settings) { |
| 1305 | |
| 1306 | // Navigation |
| 1307 | if ( isset($settings['flip_carousel_nav_icon']) && !empty($settings['flip_carousel_nav_icon']) ) { |
| 1308 | $icon_prev = '<span class="wpr-flip-carousel-navigation">'. Utilities::get_wpr_icon( $settings['flip_carousel_nav_icon'], 'left' ) .'</span>'; |
| 1309 | $icon_next = '<span class="wpr-flip-carousel-navigation">'. Utilities::get_wpr_icon( $settings['flip_carousel_nav_icon'], 'right' ) .'</span>'; |
| 1310 | } else { |
| 1311 | $icon_prev = ''; |
| 1312 | $icon_next = ''; |
| 1313 | } |
| 1314 | |
| 1315 | if ( !defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code() ) { |
| 1316 | $settings['autoplay'] = false; |
| 1317 | $settings['autoplay_milliseconds'] = 0; |
| 1318 | $settings['pause_on_hover'] = false; |
| 1319 | } |
| 1320 | |
| 1321 | $attributes = [ |
| 1322 | 'starts_from_center' => $settings['starts_from_center'], |
| 1323 | 'carousel_type' => $settings['carousel_type'], |
| 1324 | 'loop' => $settings['loop'], |
| 1325 | 'autoplay' => $settings['autoplay'], |
| 1326 | 'autoplay_milliseconds' => $settings['autoplay_milliseconds'], |
| 1327 | 'pause_on_hover' => $settings['pause_on_hover'], |
| 1328 | 'play_on_click' => $settings['play_on_click'], |
| 1329 | 'play_on_scroll' => $settings['play_on_scroll'], |
| 1330 | 'pagination_position' => $settings['pagination_position'], |
| 1331 | 'spacing' => $settings['spacing'], |
| 1332 | 'button_prev' => $icon_prev, |
| 1333 | 'button_next' => $icon_next, |
| 1334 | 'pagination_bg_color_hover' => $settings['pagination_bg_color_hover'] |
| 1335 | ]; |
| 1336 | |
| 1337 | return json_encode($attributes); |
| 1338 | } |
| 1339 | |
| 1340 | protected function render() { |
| 1341 | $settings = $this->get_settings_for_display(); |
| 1342 | |
| 1343 | if ( $settings['carousel_elements'] ) { |
| 1344 | $i = 0; |
| 1345 | echo '<div class="wpr-flip-carousel-wrapper">'; |
| 1346 | echo '<div class="wpr-flip-carousel" data-settings="'. esc_attr($this->flip_carousel_attributes($settings)) .'">'; |
| 1347 | echo '<ul class="wpr-flip-items-wrapper">'; |
| 1348 | foreach ( $settings['carousel_elements'] as $key => $element ) { |
| 1349 | if ( (!defined('WPR_ADDONS_PRO_VERSION') || !wpr_fs()->can_use_premium_code()) && $key === 4 ) { |
| 1350 | break; |
| 1351 | } |
| 1352 | |
| 1353 | if ( ! empty( $element['slide_link']['url'] ) ) { |
| 1354 | $this->add_link_attributes( 'slide_link'. $i, $element['slide_link'] ); |
| 1355 | } |
| 1356 | |
| 1357 | if ( Utils::get_placeholder_image_src() === $element['image']['url'] ) { |
| 1358 | $flip_slide_image = '<img src='. Utils::get_placeholder_image_src() .' />'; |
| 1359 | } if (WPR_ADDONS_ASSETS_URL . 'img/logo-slider-450x450.png' === $element['image']['url']) { |
| 1360 | $flip_slide_image = '<img src="'. esc_url($element['image']['url']) .'" />'; |
| 1361 | } else { |
| 1362 | $flip_slide_image = '<img alt="'. esc_attr( $element['image']['alt'] ) .'" src="'. Group_Control_Image_Size::get_attachment_image_src( $element['image']['id'], 'flip_carousel_image_size', $settings ) .'" />'; |
| 1363 | } |
| 1364 | |
| 1365 | if ( 'yes' === $settings['enable_figcaption'] ) { |
| 1366 | $figcaption = '<figcaption class="flipcaption"><span style="width: 100%;">'. esc_html($element['slide_text']) .'</span></figcaption>'; |
| 1367 | } else { |
| 1368 | $figcaption = ''; |
| 1369 | } |
| 1370 | |
| 1371 | if ( 'yes' === $settings['enable_subcaption'] ) { |
| 1372 | $subcaption = '<div class="subcaption"><span style="width: 100%;">'. esc_html($element['slide_subcaption']) .'</span></div>'; |
| 1373 | } else { |
| 1374 | $subcaption = ''; |
| 1375 | } |
| 1376 | |
| 1377 | $inner_figure = 'after' === $settings['flipcaption_position'] |
| 1378 | ? ''. $flip_slide_image . $figcaption . $subcaption .'' |
| 1379 | : ''. $figcaption . $subcaption . $flip_slide_image .''; |
| 1380 | |
| 1381 | $figure = 'yes' === $element['enable_slide_link'] |
| 1382 | ? '<a '. $this->get_render_attribute_string( 'slide_link'. $i ) .'>' . wp_kses_post($inner_figure) . '</a>' |
| 1383 | : $inner_figure; |
| 1384 | |
| 1385 | echo '<li class="wpr-flip-item" data-flip-title="">'; |
| 1386 | echo '<figure>'; |
| 1387 | echo ''. $figure; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1388 | echo '</figure>'; |
| 1389 | echo '</li>'; |
| 1390 | $i++; |
| 1391 | } |
| 1392 | echo '</ul>'; |
| 1393 | echo '</div>'; |
| 1394 | echo '</div>'; |
| 1395 | } |
| 1396 | } |
| 1397 | } |