| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | use RadiusTheme\SB\Helpers\BuilderFns; |
| 6 | 6 | use RadiusTheme\SB\Helpers\ElementorDataMap; |
| 7 | 7 | use RadiusTheme\SB\Helpers\Fns; |
| 8 | 8 | use RadiusTheme\SB\Traits\SingletonTrait; |
| 9 | -use RadiusTheme\SB\Controllers\PluginsSupport; | |
| 9 | + | |
| 10 | 10 | // Do not allow directly accessing this file. |
| 11 | 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | 12 | exit( 'This script cannot be accessed directly.' ); |
| 13 | 13 | } |
| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | */ |
| 27 | 27 | private function __construct() { |
| 28 | 28 | add_action( 'init', [ $this, 'plugins_support' ], 9 ); |
| 29 | 29 | add_action( 'init', [ $this, 'themes_support' ], 9 ); |
| 30 | - add_filter( 'woocommerce_locate_template', [ $this, 'locate_template' ], 10, 3 ); | |
| 30 | + add_filter( 'woocommerce_locate_template', [ $this, 'locate_template' ], 10, 2 ); | |
| 31 | 31 | if ( defined( 'RTSB_DEVELOPER_MODE' ) && RTSB_DEVELOPER_MODE ) { |
| 32 | 32 | $this->developer_support(); |
| 33 | 33 | } |
| 34 | 34 | } |
| @@ -70,9 +70,9 @@ | ||
| 70 | 70 | public function themes_support() { |
| 71 | 71 | $themeClass = ucwords( str_replace( [ '_', '-', ' ' ], '', rtsb()->current_theme ) ); |
| 72 | 72 | |
| 73 | 73 | $supportClass = apply_filters( |
| 74 | - 'RadiusTheme/SB/ThemesSupport/Class', | |
| 74 | + 'RadiusTheme/SB/ThemesSupport/Class', // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase | |
| 75 | 75 | [ |
| 76 | 76 | 'ThemesSupport' => 'RadiusTheme\SB\Controllers\ThemesSupport\\' . $themeClass . '\\ThemeSupport', |
| 77 | 77 | 'TheTheme' => '\ThemeSupport', |
| 78 | 78 | ] |
| @@ -89,13 +89,20 @@ | ||
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * Theme Support | |
| 93 | + * Filters and overrides the default WooCommerce template paths for specific templates | |
| 94 | + * based on builder context and available Elementor widgets. | |
| 94 | 95 | * |
| 95 | - * @return void | |
| 96 | + * - Replaces the checkout review order template if a custom widget is present. | |
| 97 | + * - Replaces the single product description tab template if on a product page. | |
| 98 | + * | |
| 99 | + * @param string $template The path to the template to include. | |
| 100 | + * @param string $template_name The name of the template. | |
| 101 | + * | |
| 102 | + * @return string Modified or original template path. | |
| 96 | 103 | */ |
| 97 | - public function locate_template( $template, $template_name, $template_path ) { | |
| 104 | + public function locate_template( $template, $template_name ) { | |
| 98 | 105 | if ( 'checkout/review-order.php' === $template_name && BuilderFns::is_checkout() ) { |
| 99 | 106 | $id = BuilderFns::is_builder_preview() ? get_the_ID() : BuilderFns::builder_page_id_by_type( 'checkout' ); |
| 100 | 107 | $elmap = ElementorDataMap::instance(); |
| 101 | 108 | if ( ! $id ) { |