Conditions.php
70 lines
| 1 | <?php |
| 2 | namespace SureCart\Integrations\Elementor\Conditions; |
| 3 | |
| 4 | use ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base; |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | exit; // Exit if accessed directly. |
| 8 | } |
| 9 | |
| 10 | /** |
| 11 | * SureCart Conditions. |
| 12 | */ |
| 13 | class Conditions extends Condition_Base { |
| 14 | /** |
| 15 | * Get the type of the condition. |
| 16 | * |
| 17 | * @return string |
| 18 | */ |
| 19 | public static function get_type() { |
| 20 | return 'surecart'; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Get the name. |
| 25 | * |
| 26 | * @return string |
| 27 | */ |
| 28 | public function get_name() { |
| 29 | return 'surecart'; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * Get the label. |
| 34 | * |
| 35 | * @return string |
| 36 | */ |
| 37 | public function get_label() { |
| 38 | return esc_html__( 'SureCart', 'elementor-pro' ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Get the all label. |
| 43 | * |
| 44 | * @return string |
| 45 | */ |
| 46 | public function get_all_label() { |
| 47 | return esc_html__( 'All Products', 'elementor-pro' ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Check condition. |
| 52 | * |
| 53 | * @param array $args The arguments. |
| 54 | * |
| 55 | * @return bool |
| 56 | */ |
| 57 | public function check( $args ) { |
| 58 | return get_query_var( 'surecart_current_product' ); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Register sub conditions. |
| 63 | * |
| 64 | * @return void |
| 65 | */ |
| 66 | public function register_sub_conditions() { |
| 67 | $this->register_sub_condition( new ProductCondition() ); |
| 68 | } |
| 69 | } |
| 70 |