| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Main ProductDescription class. |
| 5 |
* |
| 6 |
* @package RadiusTheme\SB |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace RadiusTheme\SB\Controllers\ThemesSupport\Storefront; |
| 10 |
|
| 11 |
use RadiusTheme\SB\Helpers\Fns; |
| 12 |
|
| 13 |
// Do not allow directly accessing this file. |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit( 'This script cannot be accessed directly.' ); |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Product Description class |
| 20 |
*/ |
| 21 |
class WidgetsSupport { |
| 22 |
|
| 23 |
/** |
| 24 |
* The single instance of the class. |
| 25 |
* |
| 26 |
* @var object |
| 27 |
*/ |
| 28 |
protected static $instance = null; |
| 29 |
|
| 30 |
/** |
| 31 |
* The single instance of the class. |
| 32 |
* |
| 33 |
* @var object |
| 34 |
*/ |
| 35 |
private $widgets; |
| 36 |
|
| 37 |
/** |
| 38 |
* Construct function |
| 39 |
*/ |
| 40 |
private function __construct() {} |
| 41 |
|
| 42 |
/** |
| 43 |
* Get class instance. |
| 44 |
* |
| 45 |
* @return object Instance. |
| 46 |
*/ |
| 47 |
public static function instance( $widgets ) { |
| 48 |
if ( ! self::$instance ) { |
| 49 |
self::$instance = new self(); |
| 50 |
} |
| 51 |
self::$instance->widgets = $widgets; |
| 52 |
return self::$instance; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* The function name comes from the widget base name "rtsb-products-archive". This is for theme support prefix with render. |
| 57 |
* |
| 58 |
* @return void |
| 59 |
*/ |
| 60 |
public function render_rtsb_products_archive() { |
| 61 |
$controllers = $this->widgets->get_settings_for_display(); |
| 62 |
remove_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 ); |
| 63 |
|
| 64 |
if ( empty( $controllers['show_pagination'] ) ) { |
| 65 |
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
| 66 |
} |
| 67 |
|
| 68 |
remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper', 9 ); |
| 69 |
remove_action( 'woocommerce_after_shop_loop', 'storefront_sorting_wrapper_close', 31 ); |
| 70 |
remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper', 9 ); |
| 71 |
remove_action( 'woocommerce_before_shop_loop', 'storefront_sorting_wrapper_close', 31 ); |
| 72 |
|
| 73 |
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
| 74 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
| 75 |
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
| 76 |
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
| 77 |
|
| 78 |
if ( ! empty( $controllers['show_pagination'] ) ) { |
| 79 |
if ( Fns::product_filters_has_ajax( apply_filters( 'rtsb/builder/set/current/page/type', '' ) ) ) { |
| 80 |
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
| 81 |
} |
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
|