config.php
74 lines
| 1 | <?php |
| 2 | namespace ShopPress\Elementor\Widgets; |
| 3 | |
| 4 | use Elementor\Repeater; |
| 5 | use Elementor\Controls_Manager; |
| 6 | use ShopPress\Elementor\ShopPressWidgets; |
| 7 | use ShopPress\Elementor\ControlsWidgets; |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | class ResultCount extends ShopPressWidgets { |
| 12 | |
| 13 | public function get_name() { |
| 14 | return 'sp-result-count'; |
| 15 | } |
| 16 | |
| 17 | public function get_title() { |
| 18 | return __( 'Result Count', 'shop-press' ); |
| 19 | } |
| 20 | |
| 21 | public function get_icon() { |
| 22 | return 'sp-widget sp-eicon-result-count'; |
| 23 | } |
| 24 | |
| 25 | public function get_categories() { |
| 26 | return array( 'sp_woo_shop' ); |
| 27 | } |
| 28 | |
| 29 | public function setup_styling_options() { |
| 30 | $this->register_group_styler( |
| 31 | 'wrapper', |
| 32 | __( 'Styles', 'shop-press' ), |
| 33 | array( |
| 34 | 'wrapper' => array( |
| 35 | 'label' => esc_html__( 'Wrapper', 'shop-press' ), |
| 36 | 'type' => 'styler', |
| 37 | 'selector' => '.sp-result-count', |
| 38 | 'wrapper' => '{{WRAPPER}}', |
| 39 | ), |
| 40 | 'result_text' => array( |
| 41 | 'label' => esc_html__( 'Text', 'shop-press' ), |
| 42 | 'type' => 'styler', |
| 43 | 'selector' => '.woocommerce-result-count', |
| 44 | 'wrapper' => '{{WRAPPER}}', |
| 45 | ), |
| 46 | ) |
| 47 | ); |
| 48 | } |
| 49 | |
| 50 | protected function register_controls() { |
| 51 | $this->setup_styling_options(); |
| 52 | |
| 53 | do_action( 'shoppress/elementor/widget/register_controls_init', $this ); |
| 54 | } |
| 55 | |
| 56 | protected function render() { |
| 57 | $settings = $this->get_settings_for_display(); |
| 58 | |
| 59 | do_action( 'shoppress/widget/before_render', $settings ); |
| 60 | |
| 61 | if ( $this->editor_preview() ) { |
| 62 | sp_load_builder_template( 'shop/shop-result-count' ); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | protected function content_template() { |
| 67 | ?> |
| 68 | <div class="sp-result-count"> |
| 69 | <p class="woocommerce-result-count"><?php echo esc_html( __( 'Showing all 12 results', 'shop-press' ) ); ?></p> |
| 70 | </div> |
| 71 | <?php |
| 72 | } |
| 73 | } |
| 74 |