| @@ -346,24 +346,12 @@ | ||
| 346 | 346 | $metas = $this->get_slider_meta_dataset( $this->settings, $this->template_name, $this->settings ); |
| 347 | 347 | |
| 348 | 348 | return RenderHelpers::slider_data( (array) $metas, $this->settings ); |
| 349 | 349 | } |
| 350 | - | |
| 351 | 350 | /** |
| 352 | - * Prepares and returns slider configuration dataset for rendering in Elementor or frontend use. | |
| 351 | + * Gets slider data for the carousel. | |
| 353 | 352 | * |
| 354 | - * This method collects various slider-related metadata settings, normalizes them using helper | |
| 355 | - * functions, and returns a structured dataset used to initialize and render a responsive slider. | |
| 356 | - * | |
| 357 | - * @since 1.0.0 | |
| 358 | - * | |
| 359 | - * @param array $meta Metadata array containing configuration values for the slider. | |
| 360 | - * Example keys: 'cols', 'cols_tablet', 'slider_loop', etc. | |
| 361 | - * @param string $template The template identifier or slug used for rendering slider content. | |
| 362 | - * @param array $raw_settings Raw settings passed directly from Elementor widget settings or similar source. | |
| 363 | - * | |
| 364 | - * @return array|null Returns an array of slider settings suitable for frontend use, | |
| 365 | - * optionally modified by the 'rtsb/elementor/render/slider_dataset_final' filter. | |
| 353 | + * @return string | |
| 366 | 354 | */ |
| 367 | 355 | protected function get_slider_meta_dataset( array $meta, $template = '', $raw_settings = [] ) { |
| 368 | 356 | $data = [ |
| 369 | 357 | 'widget' => 'custom', |
| @@ -387,9 +375,9 @@ | ||
| 387 | 375 | 'auto_height' => ! empty( $meta['slider_auto_height'] ), |
| 388 | 376 | 'speed' => RenderHelpers::get_data( $meta, 'slide_speed', 2000 ), |
| 389 | 377 | 'space_between' => isset( $meta['grid_gap']['size'] ) && strlen( $meta['grid_gap']['size'] ) ? $meta['grid_gap']['size'] : 30, |
| 390 | 378 | 'auto_play_timeout' => RenderHelpers::get_data( $meta, 'autoplay_timeout', 5000 ), |
| 391 | - 'nav_position' => RenderHelpers::get_data( $meta, 'slider_nav_position', 'standard' ), | |
| 379 | + 'nav_position' => RenderHelpers::get_data( $meta, 'slider_nav_position', 'top' ), | |
| 392 | 380 | 'left_arrow_icon' => RenderHelpers::get_data( $meta, 'slider_left_arrow_icon', [] ), |
| 393 | 381 | 'right_arrow_icon' => RenderHelpers::get_data( $meta, 'slider_right_arrow_icon', [] ), |
| 394 | 382 | ]; |
| 395 | 383 | if ( ! empty( $meta['cols_widescreen'] ) ) { |
| @@ -411,22 +399,11 @@ | ||
| 411 | 399 | return apply_filters( 'rtsb/elementor/render/slider_dataset_final', $data, $meta, $raw_settings ); |
| 412 | 400 | } |
| 413 | 401 | |
| 414 | 402 | /** |
| 415 | - * Generates the configuration and CSS class for the hero slider carousel. | |
| 403 | + * Gets hero slider data for the carousel. | |
| 416 | 404 | * |
| 417 | - * Prepares Swiper-compatible slider options and associated class names based on | |
| 418 | - * the provided metadata. This includes autoplay settings, pagination type, | |
| 419 | - * lazy loading, effects (e.g., parallax, fade), and responsive breakpoints. | |
| 420 | - * | |
| 421 | - * @since 1.0.0 | |
| 422 | - * | |
| 423 | - * @param array $meta Metadata array for the slider settings, including keys like | |
| 424 | - * 'slide_speed', 'slider_loop', 'slider_pagi_type', etc. | |
| 425 | - * | |
| 426 | - * @return array Returns an associative array containing: | |
| 427 | - * - 'data' (string): JSON-encoded slider options for Swiper. | |
| 428 | - * - 'class' (string): Additional CSS class names for the carousel container. | |
| 405 | + * @return array | |
| 429 | 406 | */ |
| 430 | 407 | protected function get_hero_slider_data( array $meta ) { |
| 431 | 408 | $has_dots = $meta['slider_pagi'] ? ' has-dot' : ' no-dot'; |
| 432 | 409 | $has_dots .= $meta['slider_nav'] ? ' has-nav' : ' no-nav'; |
| @@ -495,23 +472,11 @@ | ||
| 495 | 472 | } |
| 496 | 473 | |
| 497 | 474 | |
| 498 | 475 | /** |
| 499 | - * Renders the carousel slider navigation arrows and pagination markup. | |
| 476 | + * Renders the carousel slider buttons. | |
| 500 | 477 | * |
| 501 | - * This method returns HTML for Swiper navigation buttons (left/right arrows) | |
| 502 | - * and optional pagination dots, depending on the provided slider settings. | |
| 503 | - * | |
| 504 | - * @since 1.0.0 | |
| 505 | - * | |
| 506 | - * @param array $settings Slider configuration options. Expected keys: | |
| 507 | - * - 'slider_left_arrow_icon' (string) Icon for the left arrow. | |
| 508 | - * - 'slider_right_arrow_icon' (string) Icon for the right arrow. | |
| 509 | - * - 'slider_nav' (bool) Whether to show navigation arrows. | |
| 510 | - * - 'slider_pagi' (bool) Whether to show pagination. | |
| 511 | - * - 'slider_pagi_type' (string) (Optional) Pagination style (e.g., 'bullets', 'fraction'). | |
| 512 | - * | |
| 513 | - * @return string HTML markup for the slider navigation and pagination. | |
| 478 | + * @return string | |
| 514 | 479 | */ |
| 515 | 480 | protected function slider_buttons( $settings ) { |
| 516 | 481 | $html = ''; |
| 517 | 482 | $pagination_type = ''; |
| @@ -534,16 +499,9 @@ | ||
| 534 | 499 | } |
| 535 | 500 | |
| 536 | 501 | $html .= ! empty( $settings['slider_pagi'] ) ? '<div class="swiper-pagination rtsb-pos-s ' . esc_attr( $pagination_type ) . '"></div>' : ''; |
| 537 | 502 | |
| 538 | - /** | |
| 539 | - * Filters the slider navigation + pagination markup. | |
| 540 | - * | |
| 541 | - * @param string $html Slider buttons (arrows + pagination) HTML. | |
| 542 | - * @param array $settings Widget settings. | |
| 543 | - * @param GeneralAddons $instance Current render instance (exposes unique_name, id, etc.). | |
| 544 | - */ | |
| 545 | - return apply_filters( 'rtsb/general/slider_buttons/html', $html, $settings, $this ); | |
| 503 | + return $html; | |
| 546 | 504 | } |
| 547 | 505 | /** |
| 548 | 506 | * Preloader. |
| 549 | 507 | * |
| @@ -549,11 +507,8 @@ | ||
| 549 | 507 | * |
| 550 | 508 | * @return string |
| 551 | 509 | */ |
| 552 | 510 | public function pre_loader() { |
| 553 | - if ( ! Fns::enable_loader() ) { | |
| 554 | - return ''; | |
| 555 | - } | |
| 556 | 511 | if ( $this->is_carousel ) { |
| 557 | 512 | return '<div class="rtsb-elements-loading rtsb-ball-clip-rotate"><div></div></div>'; |
| 558 | 513 | } |
| 559 | 514 | return ''; |
| @@ -659,20 +614,14 @@ | ||
| 659 | 614 | </a> |
| 660 | 615 | <?php |
| 661 | 616 | } |
| 662 | 617 | /** |
| 663 | - * Renders an icon HTML markup based on position match. | |
| 618 | + * Function to render icon. | |
| 664 | 619 | * |
| 665 | - * Compares the desired icon position with the configured position | |
| 666 | - * and renders the icon HTML if they match. | |
| 620 | + * @param string $position icon position ('left' or 'right'). | |
| 621 | + * @param array $icon Position of the separator in settings. | |
| 667 | 622 | * |
| 668 | - * @since 1.0.0 | |
| 669 | - * | |
| 670 | - * @param string $position Desired position to render the icon ('left' or 'right'). | |
| 671 | - * @param string $icon Icon identifier or SVG markup. | |
| 672 | - * @param string $icon_position Actual position set in the settings ('left' or 'right'). | |
| 673 | - * | |
| 674 | - * @return string Icon HTML if position matches; otherwise, an empty string. | |
| 623 | + * @return string | |
| 675 | 624 | */ |
| 676 | 625 | public static function render_button_icon( $position, $icon, $icon_position ) { |
| 677 | 626 | $html = ''; |
| 678 | 627 | |