config.php
128 lines
| 1 | <?php |
| 2 | namespace ShopPress\Elementor\Widgets; |
| 3 | |
| 4 | use ShopPress\Elementor\ShopPressWidgets; |
| 5 | use Elementor\Controls_Manager; |
| 6 | |
| 7 | defined( 'ABSPATH' ) || exit; |
| 8 | |
| 9 | class Orders extends ShopPressWidgets { |
| 10 | |
| 11 | public function get_name() { |
| 12 | return 'sp-dashboard-orders'; |
| 13 | } |
| 14 | |
| 15 | public function get_title() { |
| 16 | return __( 'My Account Orders', 'shop-press' ); |
| 17 | } |
| 18 | |
| 19 | public function get_icon() { |
| 20 | return 'sp-widget sp-eicon-orders'; |
| 21 | } |
| 22 | |
| 23 | public function get_categories() { |
| 24 | return array( 'sp_woo_dashboard' ); |
| 25 | } |
| 26 | |
| 27 | public function setup_styling_options() { |
| 28 | $this->register_group_styler( |
| 29 | 'wrapper', |
| 30 | __( 'Wrapper', 'shop-press' ), |
| 31 | array( |
| 32 | 'wrapper' => array( |
| 33 | 'label' => esc_html__( 'Wrapper', 'shop-press' ), |
| 34 | 'type' => 'styler', |
| 35 | 'selector' => '.woocommerce-orders-table', |
| 36 | 'wrapper' => '{{WRAPPER}}', |
| 37 | ), |
| 38 | ) |
| 39 | ); |
| 40 | |
| 41 | $this->register_group_styler( |
| 42 | 'table', |
| 43 | __( 'Table', 'shop-press' ), |
| 44 | array( |
| 45 | 'table' => array( |
| 46 | 'label' => esc_html__( 'table', 'shop-press' ), |
| 47 | 'type' => 'styler', |
| 48 | 'selector' => '.woocommerce-orders-table', |
| 49 | 'wrapper' => '{{WRAPPER}}', |
| 50 | ), |
| 51 | 'thead' => array( |
| 52 | 'label' => esc_html__( 'thead', 'shop-press' ), |
| 53 | 'type' => 'styler', |
| 54 | 'selector' => 'thead', |
| 55 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table', |
| 56 | ), |
| 57 | 'tr' => array( |
| 58 | 'label' => esc_html__( 'tr', 'shop-press' ), |
| 59 | 'type' => 'styler', |
| 60 | 'selector' => 'tr', |
| 61 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table', |
| 62 | ), |
| 63 | 'th' => array( |
| 64 | 'label' => esc_html__( 'th', 'shop-press' ), |
| 65 | 'type' => 'styler', |
| 66 | 'selector' => 'th', |
| 67 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table', |
| 68 | ), |
| 69 | 'td' => array( |
| 70 | 'label' => esc_html__( 'td', 'shop-press' ), |
| 71 | 'type' => 'styler', |
| 72 | 'selector' => 'td', |
| 73 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table', |
| 74 | ), |
| 75 | 'tbody' => array( |
| 76 | 'label' => esc_html__( 'tbody', 'shop-press' ), |
| 77 | 'type' => 'styler', |
| 78 | 'selector' => 'tbody', |
| 79 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table', |
| 80 | ), |
| 81 | ) |
| 82 | ); |
| 83 | |
| 84 | $this->register_group_styler( |
| 85 | 'action_buttons', |
| 86 | __( 'Action Buttons', 'shop-press' ), |
| 87 | array( |
| 88 | 'buttons' => array( |
| 89 | 'label' => esc_html__( 'Buttons', 'shop-press' ), |
| 90 | 'type' => 'styler', |
| 91 | 'selector' => '.button', |
| 92 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table__cell-order-actions', |
| 93 | ), |
| 94 | 'button_pay' => array( |
| 95 | 'label' => esc_html__( 'Pay Button', 'shop-press' ), |
| 96 | 'type' => 'styler', |
| 97 | 'selector' => '.button.pay', |
| 98 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table__cell-order-actions', |
| 99 | ), |
| 100 | 'button_view' => array( |
| 101 | 'label' => esc_html__( 'View Button', 'shop-press' ), |
| 102 | 'type' => 'styler', |
| 103 | 'selector' => '.button.view', |
| 104 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table__cell-order-actions', |
| 105 | ), |
| 106 | 'button_cancel' => array( |
| 107 | 'label' => esc_html__( 'Cancel Button', 'shop-press' ), |
| 108 | 'type' => 'styler', |
| 109 | 'selector' => '.button.cancel', |
| 110 | 'wrapper' => '{{WRAPPER}} .woocommerce-orders-table__cell-order-actions', |
| 111 | ), |
| 112 | ) |
| 113 | ); |
| 114 | } |
| 115 | |
| 116 | protected function register_controls() { |
| 117 | $this->setup_styling_options(); |
| 118 | |
| 119 | do_action( 'shoppress/elementor/widget/register_controls_init', $this ); |
| 120 | } |
| 121 | |
| 122 | protected function render() { |
| 123 | do_action( 'shoppress/widget/before_render', $this->get_settings_for_display() ); |
| 124 | |
| 125 | sp_load_builder_template( 'my-account/orders' ); |
| 126 | } |
| 127 | } |
| 128 |