wpr-column-slider.php
5 days ago
wpr-custom-css.php
5 days ago
wpr-display-conditions.php
5 days ago
wpr-equal-height.php
5 days ago
wpr-extensions-base.php
5 days ago
wpr-parallax.php
5 days ago
wpr-particles.php
5 days ago
wpr-sticky-section.php
5 days ago
wpr-column-slider.php
948 lines
| 1 | <?php |
| 2 | use Elementor\Controls_Manager; |
| 3 | use WprAddons\Classes\Utilities; |
| 4 | use Elementor\Group_Control_Typography; |
| 5 | |
| 6 | |
| 7 | if ( ! defined( 'ABSPATH' ) ) { |
| 8 | exit; // Exit if accessed directly. |
| 9 | } |
| 10 | |
| 11 | class Wpr_Column_Slider extends Wpr_Extensions_Base { |
| 12 | public function __construct() { |
| 13 | add_action( 'elementor/element/section/section_advanced/after_section_end', [ $this, 'register_controls' ], 10 ); |
| 14 | add_action( 'elementor/section/print_template', array( $this, '_print_template' ), 10, 2 ); |
| 15 | add_action( 'elementor/frontend/section/before_render', array( $this, '_before_render' ), 10, 1 ); |
| 16 | |
| 17 | // FLEXBOX CONTAINER |
| 18 | add_action( 'elementor/element/container/section_layout/after_section_end', [ $this, 'register_controls' ], 10 ); |
| 19 | add_action( 'elementor/container/print_template', array( $this, '_print_template' ), 10, 2 ); |
| 20 | add_action( 'elementor/frontend/container/before_render', array( $this, '_before_render' ), 10, 1 ); |
| 21 | |
| 22 | } |
| 23 | |
| 24 | private function get_slides_to_show_value( $value, $fallback = 1 ) { |
| 25 | $value = absint( $value ); |
| 26 | $fallback = max( 1, absint( $fallback ) ); |
| 27 | |
| 28 | if ( $value < 1 ) { |
| 29 | $value = $fallback; |
| 30 | } |
| 31 | |
| 32 | if ( ! $this->has_active_pro_license() ) { |
| 33 | $value = min( $value, 2 ); |
| 34 | } |
| 35 | |
| 36 | return $value; |
| 37 | } |
| 38 | |
| 39 | private function get_slides_to_scroll_value( $value, $fallback = 1 ) { |
| 40 | $value = absint( $value ); |
| 41 | $fallback = max( 1, absint( $fallback ) ); |
| 42 | |
| 43 | if ( $value < 1 ) { |
| 44 | $value = $fallback; |
| 45 | } |
| 46 | |
| 47 | if ( ! $this->has_active_pro_license() ) { |
| 48 | $value = min( $value, 2 ); |
| 49 | } |
| 50 | |
| 51 | return $value; |
| 52 | } |
| 53 | |
| 54 | private function add_control_slides_to_show( $element ) { |
| 55 | if ( ! $this->maybe_call_pro_method( '\WprAddonsPro\Extensions\Wpr_Column_Slider_Pro', 'add_control_slides_to_show', [ $element ] ) ) { |
| 56 | $element->add_responsive_control( |
| 57 | 'wpr_column_slider_slides_to_show', |
| 58 | [ |
| 59 | 'label' => esc_html__( 'Slides To Show', 'wpr-addons' ), |
| 60 | 'description' => esc_html__( 'Number of slides visible at once. Free supports up to 2 slides per view.', 'wpr-addons' ), |
| 61 | 'type' => Controls_Manager::NUMBER, |
| 62 | 'default' => 1, |
| 63 | 'min' => 1, |
| 64 | 'max' => 2, |
| 65 | 'condition' => [ |
| 66 | 'wpr_enable_column_slider' => 'yes', |
| 67 | ], |
| 68 | ] |
| 69 | ); |
| 70 | |
| 71 | $element->add_control( |
| 72 | 'wpr_column_slider_slides_to_show_pro_notice', |
| 73 | [ |
| 74 | 'type' => Controls_Manager::RAW_HTML, |
| 75 | 'raw' => 'More than 2 slides per view are available<br> in the <strong><a href="https://royal-elementor-addons.com/?ref=rea-plugin-panel-column-slider-upgrade-pro#purchasepro" target="_blank">Pro version</a></strong>', |
| 76 | 'content_classes' => 'wpr-pro-notice', |
| 77 | 'condition' => [ |
| 78 | 'wpr_enable_column_slider' => 'yes', |
| 79 | ], |
| 80 | ] |
| 81 | ); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | private function add_control_autoplay( $element ) { |
| 86 | if ( ! $this->maybe_call_pro_method( '\WprAddonsPro\Extensions\Wpr_Column_Slider_Pro', 'add_control_autoplay', [ $element ] ) ) { |
| 87 | $element->add_control( |
| 88 | 'wpr_enable_column_slider_autoplay', |
| 89 | [ |
| 90 | 'type' => Controls_Manager::SWITCHER, |
| 91 | 'label' => sprintf( esc_html__( 'Autoplay %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ), |
| 92 | 'separator' => 'before', |
| 93 | 'classes' => 'wpr-pro-control', |
| 94 | 'condition' => [ |
| 95 | 'wpr_enable_column_slider' => 'yes', |
| 96 | ], |
| 97 | ] |
| 98 | ); |
| 99 | } |
| 100 | |
| 101 | $this->maybe_call_pro_method( '\WprAddonsPro\Extensions\Wpr_Column_Slider_Pro', 'add_control_autoplay_delay', [ $element ] ); |
| 102 | } |
| 103 | |
| 104 | private function add_control_slides_to_scroll( $element ) { |
| 105 | if ( ! $this->maybe_call_pro_method( '\WprAddonsPro\Extensions\Wpr_Column_Slider_Pro', 'add_control_slides_to_scroll', [ $element ] ) ) { |
| 106 | $element->add_control( |
| 107 | 'wpr_column_slider_slides_to_scroll', |
| 108 | [ |
| 109 | 'label' => sprintf( esc_html__( 'Slides To Scroll %s', 'wpr-addons' ), '<i class="eicon-pro-icon"></i>' ), |
| 110 | 'type' => Controls_Manager::NUMBER, |
| 111 | 'default' => 1, |
| 112 | 'min' => 1, |
| 113 | 'max' => 2, |
| 114 | 'classes' => 'wpr-pro-control', |
| 115 | 'condition' => [ |
| 116 | 'wpr_enable_column_slider' => 'yes', |
| 117 | ], |
| 118 | ] |
| 119 | ); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | private function add_control_pagination_type( $element ) { |
| 124 | if ( ! $this->maybe_call_pro_method( '\WprAddonsPro\Extensions\Wpr_Column_Slider_Pro', 'add_control_pagination_type', [ $element ] ) ) { |
| 125 | $element->add_control( |
| 126 | 'wpr_cs_pag_type', |
| 127 | [ |
| 128 | 'label' => esc_html__( 'Pagination Type', 'wpr-addons' ), |
| 129 | 'type' => Controls_Manager::SELECT, |
| 130 | 'default' => 'fraction', |
| 131 | 'options' => [ |
| 132 | 'fraction' => esc_html__( 'Fraction', 'wpr-addons' ), |
| 133 | 'pro-bullets' => esc_html__( 'Bullets (Pro)', 'wpr-addons' ), |
| 134 | 'pro-progressbar' => esc_html__( 'Progressbar (Pro)', 'wpr-addons' ), |
| 135 | ], |
| 136 | 'condition' => [ |
| 137 | 'wpr_enable_column_slider' => 'yes', |
| 138 | 'wpr_enable_cs_pag' => 'yes', |
| 139 | ], |
| 140 | ] |
| 141 | ); |
| 142 | |
| 143 | Utilities::upgrade_pro_notice( |
| 144 | $element, |
| 145 | Controls_Manager::RAW_HTML, |
| 146 | 'column-slider', |
| 147 | 'wpr_cs_pag_type', |
| 148 | [ 'pro-bullets', 'pro-progressbar' ] |
| 149 | ); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | public function register_controls( $element ) { |
| 154 | |
| 155 | $element->start_controls_section( |
| 156 | 'wpr_section_column_slider', |
| 157 | [ |
| 158 | 'tab' => Controls_Manager::TAB_ADVANCED, |
| 159 | 'label' => sprintf(esc_html__('Column Slider - %s', 'wpr-addons'), esc_html('RA')), |
| 160 | ] |
| 161 | ); |
| 162 | |
| 163 | $element->add_control( |
| 164 | 'wpr_section_column_slider_update', |
| 165 | [ |
| 166 | 'type' => Controls_Manager::RAW_HTML, |
| 167 | 'raw' => '<div class="elementor-update-preview editor-wpr-preview-update"><span>Update changes to Preview</span><button class="elementor-button elementor-button-success" onclick="elementor.reloadPreview();">Apply</button>', |
| 168 | 'separator' => 'after' |
| 169 | ] |
| 170 | ); |
| 171 | |
| 172 | $element->add_control ( |
| 173 | 'wpr_enable_column_slider', |
| 174 | [ |
| 175 | 'type' => Controls_Manager::SWITCHER, |
| 176 | 'label' => esc_html__( 'Enable Column Slider', 'wpr-addons' ), |
| 177 | 'description' => esc_html__( 'Converts section columns into a horizontal sliding carousel. Each column becomes a slide that users can swipe or navigate through. Click "Apply" above after enabling to see the changes.', 'wpr-addons' ), |
| 178 | 'default' => 'no', |
| 179 | 'return_value' => 'yes', |
| 180 | 'prefix_class' => 'wpr-column-slider-', |
| 181 | 'render_type' => 'template', |
| 182 | ] |
| 183 | ); |
| 184 | |
| 185 | $this->add_control_slides_to_show( $element ); |
| 186 | |
| 187 | $element->add_responsive_control( |
| 188 | 'wpr_column_slider_space_between', |
| 189 | [ |
| 190 | 'label' => __( 'Gutter', 'wpr-addons' ), |
| 191 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 192 | 'default' => 5, |
| 193 | 'condition' => [ |
| 194 | 'wpr_enable_column_slider' => 'yes', |
| 195 | ] |
| 196 | ] |
| 197 | ); |
| 198 | |
| 199 | $this->add_control_slides_to_scroll( $element ); |
| 200 | |
| 201 | $element->add_control( |
| 202 | 'wpr_column_slider_speed', |
| 203 | [ |
| 204 | 'label' => __( 'Speed', 'wpr-addons' ), |
| 205 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 206 | 'default' => 3500, |
| 207 | 'condition' => [ |
| 208 | 'wpr_enable_column_slider' => 'yes', |
| 209 | ] |
| 210 | ] |
| 211 | ); |
| 212 | |
| 213 | $element->add_control ( |
| 214 | 'wpr_enable_cs_nav', |
| 215 | [ |
| 216 | 'type' => Controls_Manager::SWITCHER, |
| 217 | 'label' => esc_html__( 'Navigation', 'wpr-addons' ), |
| 218 | 'render_type' => 'template', |
| 219 | 'separator' => 'before', |
| 220 | 'condition' => [ |
| 221 | 'wpr_enable_column_slider' => 'yes', |
| 222 | ] |
| 223 | ] |
| 224 | ); |
| 225 | |
| 226 | $element->add_control( |
| 227 | 'wpr_cs_nav_arrows', |
| 228 | [ |
| 229 | 'label' => esc_html__( 'Navigation Icon', 'wpr-addons' ), |
| 230 | 'type' => Controls_Manager::SELECT, |
| 231 | 'default' => 'fas fa-angle', |
| 232 | 'options' => [ |
| 233 | 'fas fa-angle' => esc_html__( 'Angle', 'wpr-addons' ), |
| 234 | 'fas fa-angle-double' => esc_html__( 'Angle Double', 'wpr-addons' ), |
| 235 | 'fas fa-arrow' => esc_html__( 'Arrow', 'wpr-addons' ), |
| 236 | 'fas fa-arrow-alt-circle' => esc_html__( 'Arrow Circle', 'wpr-addons' ), |
| 237 | 'far fa-arrow-alt-circle' => esc_html__( 'Arrow Circle Alt', 'wpr-addons' ), |
| 238 | 'fas fa-long-arrow-alt' => esc_html__( 'Long Arrow', 'wpr-addons' ), |
| 239 | 'fas fa-chevron' => esc_html__( 'Chevron', 'wpr-addons' ), |
| 240 | ], |
| 241 | 'condition' => [ |
| 242 | 'wpr_enable_column_slider' => 'yes', |
| 243 | 'wpr_enable_cs_nav' => 'yes' |
| 244 | ] |
| 245 | ] |
| 246 | ); |
| 247 | |
| 248 | $element->start_controls_tabs( |
| 249 | 'wpr_cs_nav_tabs', |
| 250 | [ |
| 251 | 'condition' => [ |
| 252 | 'wpr_enable_column_slider' => 'yes', |
| 253 | 'wpr_enable_cs_nav' => 'yes' |
| 254 | ] |
| 255 | ] |
| 256 | ); |
| 257 | |
| 258 | $element->start_controls_tab( |
| 259 | 'wpr_cs_nav_tab_normal', |
| 260 | [ |
| 261 | 'label' => __( 'Normal', 'wpr-addons' ), |
| 262 | ] |
| 263 | ); |
| 264 | |
| 265 | $element->add_control( |
| 266 | 'wpr_cs_nav_icon_color', |
| 267 | [ |
| 268 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 269 | 'type' => Controls_Manager::COLOR, |
| 270 | 'default' => '#FFF', |
| 271 | 'selectors' => [ |
| 272 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev i' => 'color: {{VALUE}}', |
| 273 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next i' => 'color: {{VALUE}}', |
| 274 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev svg' => 'fill: {{VALUE}}', |
| 275 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next svg' => 'fill: {{VALUE}}' |
| 276 | ], |
| 277 | 'condition' => [ |
| 278 | 'wpr_enable_column_slider' => 'yes', |
| 279 | 'wpr_enable_cs_nav' => 'yes' |
| 280 | ] |
| 281 | ] |
| 282 | ); |
| 283 | |
| 284 | $element->add_control( |
| 285 | 'wpr_cs_nav_icon_bg_color', |
| 286 | [ |
| 287 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 288 | 'type' => Controls_Manager::COLOR, |
| 289 | 'default' => '#605BE5', |
| 290 | 'selectors' => [ |
| 291 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev' => 'background-color: {{VALUE}}', |
| 292 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next' => 'background-color: {{VALUE}}', |
| 293 | ], |
| 294 | ] |
| 295 | ); |
| 296 | |
| 297 | $element->add_control( |
| 298 | 'wpr_cs_nav_icon_border_color', |
| 299 | [ |
| 300 | 'label' => esc_html__( 'Border Color', 'wpr-addons' ), |
| 301 | 'type' => Controls_Manager::COLOR, |
| 302 | 'default' => '', |
| 303 | 'selectors' => [ |
| 304 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev' => 'border-color: {{VALUE}}', |
| 305 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next' => 'border-color: {{VALUE}}', |
| 306 | ] |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | $element->add_group_control( |
| 311 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 312 | [ |
| 313 | 'name' => 'box_shadow_navigation', |
| 314 | 'label' => __( 'Box Shadow', 'wpr-addons' ), |
| 315 | 'selector' => '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev, {{WRAPPER}}.wpr-column-slider-yes .swiper-button-next', |
| 316 | ] |
| 317 | ); |
| 318 | |
| 319 | $element->add_control( |
| 320 | 'navigation_transition', |
| 321 | [ |
| 322 | 'label' => esc_html__( 'Transition', 'wpr-addons' ), |
| 323 | 'type' => Controls_Manager::NUMBER, |
| 324 | 'default' => 1, |
| 325 | 'min' => 0, |
| 326 | 'max' => 5, |
| 327 | 'step' => 0.1, |
| 328 | 'selectors' => [ |
| 329 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev' => '-webkit-transition: all {{VALUE}}s ease; transition: all {{VALUE}}s ease;', |
| 330 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next' => '-webkit-transition: all {{VALUE}}s ease; transition: all {{VALUE}}s ease;', |
| 331 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev i' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 332 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next i' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 333 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev svg' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;', |
| 334 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next svg' => '-webkit-transition-duration: {{VALUE}}s; transition-duration: {{VALUE}}s;' |
| 335 | ], |
| 336 | ] |
| 337 | ); |
| 338 | |
| 339 | $element->end_controls_tab(); |
| 340 | |
| 341 | $element->start_controls_tab( |
| 342 | 'wpr_cs_nav_tab_hover', |
| 343 | [ |
| 344 | 'label' => __( 'Hover', 'wpr-addons' ), |
| 345 | ] |
| 346 | ); |
| 347 | |
| 348 | $element->add_control( |
| 349 | 'wpr_cs_nav_icon_color_hover', |
| 350 | [ |
| 351 | 'label' => esc_html__( 'Icon Color', 'wpr-addons' ), |
| 352 | 'type' => Controls_Manager::COLOR, |
| 353 | 'default' => '', |
| 354 | 'selectors' => [ |
| 355 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next:hover i' => 'color: {{VALUE}}', |
| 356 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev:hover i' => 'color: {{VALUE}}', |
| 357 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev:hover svg' => 'fill: {{VALUE}}', |
| 358 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next:hover svg' => 'fill: {{VALUE}}' |
| 359 | ] |
| 360 | ] |
| 361 | ); |
| 362 | |
| 363 | $element->add_control( |
| 364 | 'wpr_cs_nav_icon_bg_color_hover', |
| 365 | [ |
| 366 | 'label' => esc_html__( 'Background Color', 'wpr-addons' ), |
| 367 | 'type' => Controls_Manager::COLOR, |
| 368 | 'default' => '#423EC0', |
| 369 | 'selectors' => [ |
| 370 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev:hover' => 'background-color: {{VALUE}}', |
| 371 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next:hover' => 'background-color: {{VALUE}}', |
| 372 | ], |
| 373 | ] |
| 374 | ); |
| 375 | |
| 376 | $element->add_control( |
| 377 | 'wpr_cs_nav_icon_border_color_hover', |
| 378 | [ |
| 379 | 'label' => esc_html__( 'Border Color', 'wpr-addons' ), |
| 380 | 'type' => Controls_Manager::COLOR, |
| 381 | 'default' => '', |
| 382 | 'selectors' => [ |
| 383 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev:hover' => 'border-color: {{VALUE}}', |
| 384 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next:hover' => 'border-color: {{VALUE}}', |
| 385 | ] |
| 386 | ] |
| 387 | ); |
| 388 | |
| 389 | $element->add_group_control( |
| 390 | \Elementor\Group_Control_Box_Shadow::get_type(), |
| 391 | [ |
| 392 | 'name' => 'box_shadow_navigation_hover', |
| 393 | 'label' => __( 'Box Shadow', 'wpr-addons' ), |
| 394 | 'selector' => '{{WRAPPER}} .flipster__button:hover', |
| 395 | ] |
| 396 | ); |
| 397 | |
| 398 | $element->end_controls_tab(); |
| 399 | |
| 400 | $element->end_controls_tabs(); |
| 401 | |
| 402 | $element->add_responsive_control( |
| 403 | 'wpr_cs_nav_icon_size', |
| 404 | [ |
| 405 | 'type' => Controls_Manager::SLIDER, |
| 406 | 'label' => esc_html__( 'Icon Size', 'wpr-addons' ), |
| 407 | 'size_units' => [ 'px' ], |
| 408 | 'range' => [ |
| 409 | 'px' => [ |
| 410 | 'min' => 0, |
| 411 | 'max' => 200, |
| 412 | ] |
| 413 | ], |
| 414 | 'default' => [ |
| 415 | 'unit' => 'px', |
| 416 | 'size' => 20, |
| 417 | ], |
| 418 | 'selectors' => [ |
| 419 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 420 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 421 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 422 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};' |
| 423 | ], |
| 424 | 'separator' => 'before', |
| 425 | 'condition' => [ |
| 426 | 'wpr_enable_column_slider' => 'yes', |
| 427 | 'wpr_enable_cs_nav' => 'yes' |
| 428 | ] |
| 429 | ] |
| 430 | ); |
| 431 | |
| 432 | $element->add_responsive_control( |
| 433 | 'wpr_cs_nav_icon_bg_size', |
| 434 | [ |
| 435 | 'type' => Controls_Manager::SLIDER, |
| 436 | 'label' => esc_html__( 'Box Size', 'wpr-addons' ), |
| 437 | 'size_units' => [ 'px' ], |
| 438 | 'range' => [ |
| 439 | 'px' => [ |
| 440 | 'min' => 0, |
| 441 | 'max' => 150, |
| 442 | ] |
| 443 | ], |
| 444 | 'default' => [ |
| 445 | 'unit' => 'px', |
| 446 | 'size' => 35, |
| 447 | ], |
| 448 | 'selectors' => [ |
| 449 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 450 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};' |
| 451 | ], |
| 452 | 'condition' => [ |
| 453 | 'wpr_enable_column_slider' => 'yes', |
| 454 | 'wpr_enable_cs_nav' => 'yes' |
| 455 | ] |
| 456 | ] |
| 457 | ); |
| 458 | |
| 459 | $element->add_control( |
| 460 | 'wpr_cs_nav_border', |
| 461 | [ |
| 462 | 'label' => esc_html__( 'Border Type', 'wpr-addons' ), |
| 463 | 'type' => Controls_Manager::SELECT, |
| 464 | 'options' => [ |
| 465 | 'none' => esc_html__( 'None', 'wpr-addons' ), |
| 466 | 'solid' => esc_html__( 'Solid', 'wpr-addons' ), |
| 467 | 'double' => esc_html__( 'Double', 'wpr-addons' ), |
| 468 | 'dotted' => esc_html__( 'Dotted', 'wpr-addons' ), |
| 469 | 'dashed' => esc_html__( 'Dashed', 'wpr-addons' ), |
| 470 | 'groove' => esc_html__( 'Groove', 'wpr-addons' ), |
| 471 | ], |
| 472 | 'default' => 'none', |
| 473 | 'selectors' => [ |
| 474 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev' => 'border-style: {{VALUE}};', |
| 475 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next' => 'border-style: {{VALUE}};' |
| 476 | ], |
| 477 | 'separator' => 'before', |
| 478 | 'condition' => [ |
| 479 | 'wpr_enable_column_slider' => 'yes', |
| 480 | 'wpr_enable_cs_nav' => 'yes' |
| 481 | ] |
| 482 | ] |
| 483 | ); |
| 484 | |
| 485 | $element->add_control( |
| 486 | 'wpr_cs_nav_border_width', |
| 487 | [ |
| 488 | 'type' => Controls_Manager::DIMENSIONS, |
| 489 | 'label' => esc_html__( 'Border Width', 'wpr-addons' ), |
| 490 | 'size_units' => [ 'px', '%' ], |
| 491 | 'range' => [ |
| 492 | 'px' => [ |
| 493 | 'min' => 0, |
| 494 | 'max' => 150, |
| 495 | ], |
| 496 | '%' => [ |
| 497 | 'min' => 0, |
| 498 | 'max' => 100, |
| 499 | ] |
| 500 | ], |
| 501 | 'default' => [ |
| 502 | 'top' => 1, |
| 503 | 'right' => 1, |
| 504 | 'bottom' => 1, |
| 505 | 'left' => 1, |
| 506 | 'unit' => 'px' |
| 507 | ], |
| 508 | 'selectors' => [ |
| 509 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 510 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 511 | ], |
| 512 | 'condition' => [ |
| 513 | 'wpr_enable_column_slider' => 'yes', |
| 514 | 'wpr_enable_cs_nav' => 'yes', |
| 515 | 'wpr_cs_nav_border!' => 'none' |
| 516 | ] |
| 517 | ] |
| 518 | ); |
| 519 | |
| 520 | $element->add_control( |
| 521 | 'icon_border_radius', |
| 522 | [ |
| 523 | 'type' => Controls_Manager::DIMENSIONS, |
| 524 | 'label' => esc_html__( 'Border Radius', 'wpr-addons' ), |
| 525 | 'size_units' => [ 'px', '%' ], |
| 526 | 'range' => [ |
| 527 | 'px' => [ |
| 528 | 'min' => 0, |
| 529 | 'max' => 150, |
| 530 | ], |
| 531 | '%' => [ |
| 532 | 'min' => 0, |
| 533 | 'max' => 100, |
| 534 | ] |
| 535 | ], |
| 536 | 'default' => [ |
| 537 | 'top' => 0, |
| 538 | 'right' => 0, |
| 539 | 'bottom' => 0, |
| 540 | 'left' => 0, |
| 541 | 'unit' => 'px' |
| 542 | ], |
| 543 | 'selectors' => [ |
| 544 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-prev' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 545 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-button-next' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 546 | ], |
| 547 | 'condition' => [ |
| 548 | 'wpr_enable_column_slider' => 'yes', |
| 549 | 'wpr_enable_cs_nav' => 'yes' |
| 550 | ] |
| 551 | ] |
| 552 | ); |
| 553 | |
| 554 | $element->add_control ( |
| 555 | 'wpr_enable_cs_pag', |
| 556 | [ |
| 557 | 'type' => Controls_Manager::SWITCHER, |
| 558 | 'label' => esc_html__( 'Pagination', 'wpr-addons' ), |
| 559 | 'render_type' => 'template', |
| 560 | 'separator' => 'before', |
| 561 | 'condition' => [ |
| 562 | 'wpr_enable_column_slider' => 'yes', |
| 563 | ] |
| 564 | ] |
| 565 | ); |
| 566 | |
| 567 | $this->add_control_pagination_type( $element ); |
| 568 | |
| 569 | $element->add_control( |
| 570 | 'wpr_cs_pag_color', |
| 571 | [ |
| 572 | 'label' => esc_html__( 'Color', 'wpr-addons' ), |
| 573 | 'type' => Controls_Manager::COLOR, |
| 574 | 'default' => '#605BE5', |
| 575 | 'selectors' => [ |
| 576 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-bullet' => 'background-color: {{VALUE}}', |
| 577 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-fraction' => 'color: {{VALUE}}', |
| 578 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-progressbar' => 'background-color: {{VALUE}};', |
| 579 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-progressbar-fill' => 'background-color: {{VALUE}};' |
| 580 | ], |
| 581 | 'condition' => [ |
| 582 | 'wpr_enable_column_slider' => 'yes', |
| 583 | 'wpr_enable_cs_pag' => 'yes', |
| 584 | ] |
| 585 | ] |
| 586 | ); |
| 587 | |
| 588 | $element->add_control( |
| 589 | 'wpr_cs_pag_active_color', |
| 590 | [ |
| 591 | 'label' => esc_html__( 'Active Bullet Color', 'wpr-addons' ), |
| 592 | 'type' => Controls_Manager::COLOR, |
| 593 | 'default' => '', |
| 594 | 'selectors' => [ |
| 595 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-bullet-active' => 'background-color: {{VALUE}}', |
| 596 | ], |
| 597 | 'condition' => [ |
| 598 | 'wpr_enable_column_slider' => 'yes', |
| 599 | 'wpr_enable_cs_pag' => 'yes', |
| 600 | 'wpr_cs_pag_type' => 'bullets' |
| 601 | ] |
| 602 | ] |
| 603 | ); |
| 604 | |
| 605 | $element->add_control( |
| 606 | 'wpr_cs_pag_bg_color', |
| 607 | [ |
| 608 | 'label' => esc_html__( 'Bar Background', 'wpr-addons' ), |
| 609 | 'type' => Controls_Manager::COLOR, |
| 610 | 'default' => '#EDEDED', |
| 611 | 'selectors' => [ |
| 612 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-progressbar' => 'background-color: {{VALUE}};' |
| 613 | ], |
| 614 | 'condition' => [ |
| 615 | 'wpr_enable_column_slider' => 'yes', |
| 616 | 'wpr_enable_cs_pag' => 'yes', |
| 617 | 'wpr_cs_pag_type' => 'progressbar' |
| 618 | ] |
| 619 | ] |
| 620 | ); |
| 621 | |
| 622 | $element->add_responsive_control( |
| 623 | 'wpr_cs_pag_progressbar_height', |
| 624 | [ |
| 625 | 'type' => Controls_Manager::SLIDER, |
| 626 | 'label' => esc_html__( 'Progress Bar Height', 'wpr-addons' ), |
| 627 | 'size_units' => [ 'px' ], |
| 628 | 'range' => [ |
| 629 | 'px' => [ |
| 630 | 'min' => 1, |
| 631 | 'max' => 15, |
| 632 | ] |
| 633 | ], |
| 634 | 'default' => [ |
| 635 | 'unit' => 'px', |
| 636 | 'size' => 5, |
| 637 | ], |
| 638 | 'selectors' => [ |
| 639 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-progressbar' => 'height: {{SIZE}}{{UNIT}};', |
| 640 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-progressbar-fill' => 'height: {{SIZE}}{{UNIT}};' |
| 641 | ], |
| 642 | 'condition' => [ |
| 643 | 'wpr_enable_column_slider' => 'yes', |
| 644 | 'wpr_enable_cs_pag' => 'yes', |
| 645 | 'wpr_cs_pag_type' => 'progressbar' |
| 646 | ] |
| 647 | ] |
| 648 | ); |
| 649 | |
| 650 | $element->add_responsive_control( |
| 651 | 'wpr_cs_pag_size', |
| 652 | [ |
| 653 | 'type' => Controls_Manager::SLIDER, |
| 654 | 'label' => esc_html__( 'Box Size', 'wpr-addons' ), |
| 655 | 'size_units' => [ 'px' ], |
| 656 | 'range' => [ |
| 657 | 'px' => [ |
| 658 | 'min' => 0, |
| 659 | 'max' => 50, |
| 660 | ] |
| 661 | ], |
| 662 | 'default' => [ |
| 663 | 'unit' => 'px', |
| 664 | 'size' => 7, |
| 665 | ], |
| 666 | 'selectors' => [ |
| 667 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-bullet' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};' |
| 668 | ], |
| 669 | 'condition' => [ |
| 670 | 'wpr_enable_column_slider' => 'yes', |
| 671 | 'wpr_enable_cs_pag' => 'yes', |
| 672 | 'wpr_cs_pag_type' => 'bullets' |
| 673 | ] |
| 674 | ] |
| 675 | ); |
| 676 | |
| 677 | $element->add_group_control( |
| 678 | \Elementor\Group_Control_Typography::get_type(), |
| 679 | [ |
| 680 | 'name' => 'wpr_cs_pag_fraction_typography', |
| 681 | 'label' => __( 'Typography', 'wpr-addons' ), |
| 682 | 'selector' => '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-fraction', |
| 683 | 'fields_options' => [ |
| 684 | 'typography' => [ |
| 685 | 'default' => 'custom', |
| 686 | ], |
| 687 | 'font_size' => [ |
| 688 | 'default' => [ |
| 689 | 'size' => '14', |
| 690 | 'unit' => 'px', |
| 691 | ] |
| 692 | ] |
| 693 | ], |
| 694 | 'condition' => [ |
| 695 | 'wpr_enable_column_slider' => 'yes', |
| 696 | 'wpr_enable_cs_pag' => 'yes', |
| 697 | 'wpr_cs_pag_type' => 'fraction' |
| 698 | ] |
| 699 | ] |
| 700 | ); |
| 701 | |
| 702 | $element->add_responsive_control( |
| 703 | 'wpr_cs_pag_margin', |
| 704 | [ |
| 705 | 'label' => esc_html__( 'Margin', 'wpr-addons' ), |
| 706 | 'type' => Controls_Manager::DIMENSIONS, |
| 707 | 'size_units' => [ 'px', '%' ], |
| 708 | 'default' => [ |
| 709 | 'top' => 0, |
| 710 | 'right' => 6, |
| 711 | 'bottom' => 0, |
| 712 | 'left' => 6, |
| 713 | ], |
| 714 | 'selectors' => [ |
| 715 | '{{WRAPPER}}.wpr-column-slider-yes .swiper-pagination-bullet' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 716 | ], |
| 717 | 'condition' => [ |
| 718 | 'wpr_enable_column_slider' => 'yes', |
| 719 | 'wpr_enable_cs_pag' => 'yes', |
| 720 | 'wpr_cs_pag_type' => 'bullets' |
| 721 | ] |
| 722 | ] |
| 723 | ); |
| 724 | |
| 725 | $this->add_control_autoplay( $element ); |
| 726 | |
| 727 | $element->add_control ( |
| 728 | 'wpr_enable_column_slider_loop', |
| 729 | [ |
| 730 | 'type' => Controls_Manager::SWITCHER, |
| 731 | 'label' => esc_html__( 'Loop', 'wpr-addons' ), |
| 732 | 'render_type' => 'template', |
| 733 | 'separator' => 'before', |
| 734 | 'condition' => [ |
| 735 | 'wpr_enable_column_slider' => 'yes', |
| 736 | ] |
| 737 | ] |
| 738 | ); |
| 739 | |
| 740 | $element->end_controls_section(); |
| 741 | |
| 742 | } |
| 743 | |
| 744 | public function _before_render( $element ) { |
| 745 | if ( $element->get_name() !== 'section' && $element->get_name() !== 'container' ) { |
| 746 | return; |
| 747 | } |
| 748 | |
| 749 | $settings = $element->get_settings_for_display(); |
| 750 | |
| 751 | if ( 'yes' === $settings['wpr_enable_column_slider'] ) { |
| 752 | if ( wp_style_is( 'e-swiper', 'registered' ) ) { |
| 753 | wp_enqueue_style( 'e-swiper' ); |
| 754 | } elseif ( wp_style_is( 'swiper', 'registered' ) ) { |
| 755 | wp_enqueue_style( 'swiper' ); |
| 756 | } |
| 757 | |
| 758 | $navigation = $settings['wpr_enable_cs_nav']; |
| 759 | $pagination = $settings['wpr_enable_cs_pag']; |
| 760 | $pagination_type = isset($settings['wpr_cs_pag_type']) ? $settings['wpr_cs_pag_type'] : ''; |
| 761 | $autoplay = isset( $settings['wpr_enable_column_slider_autoplay'] ) ? $settings['wpr_enable_column_slider_autoplay'] : ''; |
| 762 | $loop = $settings['wpr_enable_column_slider_loop']; |
| 763 | $slides_to_show = $this->get_slides_to_show_value( $settings['wpr_column_slider_slides_to_show'] ); |
| 764 | $slides_to_show_widescreen = $this->get_slides_to_show_value( isset( $settings['wpr_column_slider_slides_to_show_widescreen'] ) ? $settings['wpr_column_slider_slides_to_show_widescreen'] : $slides_to_show, $slides_to_show ); |
| 765 | $slides_to_show_laptop = $this->get_slides_to_show_value( isset( $settings['wpr_column_slider_slides_to_show_laptop'] ) ? $settings['wpr_column_slider_slides_to_show_laptop'] : $slides_to_show, $slides_to_show ); |
| 766 | $slides_to_show_tablet_extra = $this->get_slides_to_show_value( isset( $settings['wpr_column_slider_slides_to_show_tablet_extra'] ) ? $settings['wpr_column_slider_slides_to_show_tablet_extra'] : $slides_to_show_laptop, $slides_to_show_laptop ); |
| 767 | $slides_to_show_tablet = $this->get_slides_to_show_value( isset( $settings['wpr_column_slider_slides_to_show_tablet'] ) ? $settings['wpr_column_slider_slides_to_show_tablet'] : $slides_to_show_tablet_extra, $slides_to_show_tablet_extra ); |
| 768 | $slides_to_show_mobile_extra = $this->get_slides_to_show_value( isset( $settings['wpr_column_slider_slides_to_show_mobile_extra'] ) ? $settings['wpr_column_slider_slides_to_show_mobile_extra'] : $slides_to_show_tablet, $slides_to_show_tablet ); |
| 769 | $slides_to_show_mobile = $this->get_slides_to_show_value( isset( $settings['wpr_column_slider_slides_to_show_mobile'] ) ? $settings['wpr_column_slider_slides_to_show_mobile'] : $slides_to_show_mobile_extra, $slides_to_show_mobile_extra ); |
| 770 | $slides_to_scroll = $this->get_slides_to_scroll_value( isset( $settings['wpr_column_slider_slides_to_scroll'] ) ? $settings['wpr_column_slider_slides_to_scroll'] : 1 ); |
| 771 | $space_between = $settings['wpr_column_slider_space_between']; |
| 772 | $space_between_widescreen = isset($settings['wpr_column_slider_space_between_widescreen']) ? $settings['wpr_column_slider_space_between_widescreen'] : $space_between; |
| 773 | $space_between_laptop = isset($settings['wpr_column_slider_space_between_laptop']) ? $settings['wpr_column_slider_space_between_laptop'] : $space_between; |
| 774 | $space_between_tablet_extra = isset($settings['wpr_column_slider_space_between_tablet_extra']) ? $settings['wpr_column_slider_space_between_tablet_extra'] : $space_between_laptop; |
| 775 | $space_between_tablet = isset($settings['wpr_column_slider_space_between_tablet']) ? $settings['wpr_column_slider_space_between_tablet'] : $space_between_tablet_extra; |
| 776 | $space_between_mobile_extra = isset($settings['wpr_column_slider_space_between_mobile_extra']) ? $settings['wpr_column_slider_space_between_mobile_extra'] : $space_between_tablet; |
| 777 | $space_between_mobile = isset($settings['wpr_column_slider_space_between_mobile']) ? $settings['wpr_column_slider_space_between_mobile'] : $space_between_mobile_extra; |
| 778 | $delay = isset($settings['wpr_column_slider_delay']) ? $settings['wpr_column_slider_delay'] : ''; |
| 779 | $speed = $settings['wpr_column_slider_speed']; |
| 780 | |
| 781 | if ( ! $this->has_active_pro_license() ) { |
| 782 | $autoplay = ''; |
| 783 | $delay = ''; |
| 784 | |
| 785 | if ( in_array( $pagination_type, [ 'bullets', 'progressbar', 'pro-bullets', 'pro-progressbar' ], true ) ) { |
| 786 | $pagination_type = 'fraction'; |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | $column_slider_settings = [ |
| 791 | 'wpr_cs_navigation' => $navigation, |
| 792 | 'wpr_cs_pagination' => $pagination, |
| 793 | 'wpr_cs_pagination_type' => $pagination_type, |
| 794 | 'wpr_cs_autoplay' => $autoplay, |
| 795 | 'wpr_cs_loop' => $loop, |
| 796 | 'wpr_cs_slides_to_show' => $slides_to_show, |
| 797 | 'wpr_cs_slides_to_show_widescreen' => $slides_to_show_widescreen, |
| 798 | 'wpr_cs_slides_to_show_laptop' => $slides_to_show_laptop, |
| 799 | 'wpr_cs_slides_to_show_tablet_extra' => $slides_to_show_tablet_extra, |
| 800 | 'wpr_cs_slides_to_show_tablet' => $slides_to_show_tablet, |
| 801 | 'wpr_cs_slides_to_show_mobile_extra' => $slides_to_show_mobile_extra, |
| 802 | 'wpr_cs_slides_to_show_mobile' => $slides_to_show_mobile, |
| 803 | 'wpr_cs_slides_to_scroll' => $slides_to_scroll, |
| 804 | 'wpr_cs_space_between' => $space_between, |
| 805 | 'wpr_cs_space_between_widescreen' => $space_between_widescreen, |
| 806 | 'wpr_cs_space_between_laptop' => $space_between_laptop, |
| 807 | 'wpr_cs_space_between_tablet_extra' => $space_between_tablet_extra, |
| 808 | 'wpr_cs_space_between_tablet' => $space_between_tablet, |
| 809 | 'wpr_cs_space_between_mobile_extra' => $space_between_mobile_extra, |
| 810 | 'wpr_cs_space_between_mobile' => $space_between_mobile, |
| 811 | 'wpr_cs_delay' => $delay, |
| 812 | 'wpr_cs_speed' => $speed, |
| 813 | // 'enable_on' => $settings['wpr_enable_equal_height_on'], |
| 814 | ]; |
| 815 | |
| 816 | if ( 'yes' === $settings['wpr_enable_cs_nav'] ) { |
| 817 | echo '<div class="wpr-column-slider-navigation">'; |
| 818 | echo Utilities::get_wpr_icon( $settings['wpr_cs_nav_arrows'], 'left' ); |
| 819 | echo Utilities::get_wpr_icon( $settings['wpr_cs_nav_arrows'], 'right' ); |
| 820 | echo '</div>'; |
| 821 | } |
| 822 | |
| 823 | $element->add_render_attribute( '_wrapper', 'data-wpr-column-slider', wp_json_encode( $column_slider_settings ) ); |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | public function _print_template( $template, $widget ) { |
| 828 | if ( $widget->get_name() !== 'section' && $widget->get_name() !== 'container' ) { |
| 829 | return $template; |
| 830 | } |
| 831 | |
| 832 | ob_start(); |
| 833 | |
| 834 | ?> |
| 835 | <# if( 'yes' === settings.wpr_enable_column_slider ) { |
| 836 | var hasProColumnSlider = <?php echo $this->has_active_pro_license() ? 'true' : 'false'; ?>; |
| 837 | var getSlidesToShowValue = function( value, fallback ) { |
| 838 | var parsedValue = parseInt( value, 10 ); |
| 839 | var parsedFallback = parseInt( fallback, 10 ); |
| 840 | |
| 841 | if ( isNaN( parsedFallback ) || parsedFallback < 1 ) { |
| 842 | parsedFallback = 1; |
| 843 | } |
| 844 | |
| 845 | if ( isNaN( parsedValue ) || parsedValue < 1 ) { |
| 846 | parsedValue = parsedFallback; |
| 847 | } |
| 848 | |
| 849 | if ( ! hasProColumnSlider ) { |
| 850 | parsedValue = Math.min( parsedValue, 2 ); |
| 851 | } |
| 852 | |
| 853 | return parsedValue; |
| 854 | }; |
| 855 | |
| 856 | <!-- view.addRenderAttribute( 'wpr_column_slider', 'id', 'wpr-column-slider-' + view.getID() ); --> |
| 857 | var navigation = settings.wpr_enable_cs_nav; |
| 858 | var pagination = settings.wpr_enable_cs_pag; |
| 859 | var pagination_type = settings.wpr_cs_pag_type ? settings.wpr_cs_pag_type : ''; |
| 860 | var autoplay = hasProColumnSlider ? settings.wpr_enable_column_slider_autoplay : ''; |
| 861 | var loop = settings.wpr_enable_column_slider_loop; |
| 862 | var slides_to_show = getSlidesToShowValue( settings.wpr_column_slider_slides_to_show, 1 ); |
| 863 | var slides_to_show_widescreen = getSlidesToShowValue( settings.wpr_column_slider_slides_to_show_widescreen, slides_to_show ); |
| 864 | var slides_to_show_laptop = getSlidesToShowValue( settings.wpr_column_slider_slides_to_show_laptop, slides_to_show ); |
| 865 | var slides_to_show_tablet_extra = getSlidesToShowValue( settings.wpr_column_slider_slides_to_show_tablet_extra, slides_to_show_laptop ); |
| 866 | var slides_to_show_tablet = getSlidesToShowValue( settings.wpr_column_slider_slides_to_show_tablet, slides_to_show_tablet_extra ); |
| 867 | var slides_to_show_mobile_extra = getSlidesToShowValue( settings.wpr_column_slider_slides_to_show_mobile_extra, slides_to_show_tablet ); |
| 868 | var slides_to_show_mobile = getSlidesToShowValue( settings.wpr_column_slider_slides_to_show_mobile, slides_to_show_mobile_extra ); |
| 869 | var slides_to_scroll = getSlidesToShowValue( settings.wpr_column_slider_slides_to_scroll, 1 ); |
| 870 | var space_between = settings.wpr_column_slider_space_between; |
| 871 | var space_between_widescreen = settings.wpr_column_slider_space_between_widescreen ? settings.wpr_column_slider_space_between_widescreen : space_between; |
| 872 | var space_between_laptop = settings.wpr_column_slider_space_between_laptop ? settings.wpr_column_slider_space_between_laptop : space_between; |
| 873 | var space_between_tablet_extra = settings.wpr_column_slider_space_between_tablet_extra ? settings.wpr_column_slider_space_between_tablet_extra : space_between_laptop; |
| 874 | var space_between_tablet = settings.wpr_column_slider_space_between_tablet ? settings.wpr_column_slider_space_between_tablet : space_between_tablet_extra; |
| 875 | var space_between_mobile_extra = settings.wpr_column_slider_space_between_mobile_extra ? settings.wpr_column_slider_space_between_mobile_extra : space_between_tablet; |
| 876 | var space_between_mobile = settings.wpr_column_slider_space_between_mobile ? settings.wpr_column_slider_space_between_mobile : space_between_mobile_extra; |
| 877 | var delay = hasProColumnSlider && settings.wpr_column_slider_delay ? settings.wpr_column_slider_delay : ''; |
| 878 | var speed = settings.wpr_column_slider_speed; |
| 879 | |
| 880 | if ( ! hasProColumnSlider && ( pagination_type === 'bullets' || pagination_type === 'progressbar' || pagination_type === 'pro-bullets' || pagination_type === 'pro-progressbar' ) ) { |
| 881 | pagination_type = 'fraction'; |
| 882 | } |
| 883 | |
| 884 | columnSliderSettings = { |
| 885 | 'wpr_cs_navigation': navigation, |
| 886 | 'wpr_cs_pagination': pagination, |
| 887 | 'wpr_cs_pagination_type': pagination_type, |
| 888 | 'wpr_cs_autoplay': autoplay, |
| 889 | 'wpr_cs_loop': loop, |
| 890 | 'wpr_cs_slides_to_show': slides_to_show, |
| 891 | 'wpr_cs_slides_to_show_widescreen': slides_to_show_widescreen, |
| 892 | 'wpr_cs_slides_to_show_laptop': slides_to_show_laptop, |
| 893 | 'wpr_cs_slides_to_show_tablet_extra': slides_to_show_tablet_extra, |
| 894 | 'wpr_cs_slides_to_show_tablet': slides_to_show_tablet, |
| 895 | 'wpr_cs_slides_to_show_mobile_extra': slides_to_show_mobile_extra, |
| 896 | 'wpr_cs_slides_to_show_mobile': slides_to_show_mobile, |
| 897 | 'wpr_cs_slides_to_scroll': slides_to_scroll, |
| 898 | 'wpr_cs_space_between': space_between, |
| 899 | 'wpr_cs_space_between_widescreen': space_between_widescreen, |
| 900 | 'wpr_cs_space_between_laptop': space_between_laptop, |
| 901 | 'wpr_cs_space_between_tablet_extra': space_between_tablet_extra, |
| 902 | 'wpr_cs_space_between_tablet': space_between_tablet, |
| 903 | 'wpr_cs_space_between_mobile_extra': space_between_mobile_extra, |
| 904 | 'wpr_cs_space_between_mobile': space_between_mobile, |
| 905 | 'wpr_cs_delay': delay, |
| 906 | 'wpr_cs_speed': speed, |
| 907 | <!-- 'enable_on':settings.wpr_enable_equal_height_on --> |
| 908 | }; |
| 909 | |
| 910 | view.addRenderAttribute( 'wpr_column_slider', { |
| 911 | 'class' : 'wpr-column-slider-editor', |
| 912 | 'id' : 'wpr-column-slider-' + view.getID(), |
| 913 | 'data-wpr-column-slider': JSON.stringify( columnSliderSettings ) |
| 914 | }); |
| 915 | |
| 916 | var csNavigationArrows = settings.wpr_cs_nav_arrows; |
| 917 | |
| 918 | view.addRenderAttribute( 'wpr_navigation_arrows_left', { |
| 919 | 'class' : csNavigationArrows + '-left', |
| 920 | }); |
| 921 | |
| 922 | view.addRenderAttribute( 'wpr_navigation_arrows_right', { |
| 923 | 'class' : csNavigationArrows + '-right', |
| 924 | }); |
| 925 | |
| 926 | #> |
| 927 | <div {{{ view.getRenderAttributeString( 'wpr_column_slider' ) }}}> |
| 928 | <# if ( settings.wpr_enable_cs_nav === 'yes' ) { #> |
| 929 | <div class='wpr-column-slider-navigation-editor'> |
| 930 | <i {{{ view.getRenderAttributeString( 'wpr_navigation_arrows_left' ) }}}></i> |
| 931 | <i {{{ view.getRenderAttributeString( 'wpr_navigation_arrows_right' ) }}}></i> |
| 932 | </div> |
| 933 | <# } #> |
| 934 | </div> |
| 935 | <# } #> |
| 936 | <?php |
| 937 | |
| 938 | // how to render attributes without creating new div using view.addRenderAttributes |
| 939 | $column_slider_content = ob_get_contents(); |
| 940 | |
| 941 | ob_end_clean(); |
| 942 | |
| 943 | return $template . $column_slider_content; |
| 944 | } |
| 945 | |
| 946 | } |
| 947 | |
| 948 | new Wpr_Column_Slider(); |