1 | <?php |
||
20 | abstract class WC_Settings_Page { |
||
21 | |||
22 | /** |
||
23 | * Setting page id. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $id = ''; |
||
28 | |||
29 | /** |
||
30 | * Setting page label. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $label = ''; |
||
35 | |||
36 | /** |
||
37 | * Constructor. |
||
38 | */ |
||
39 | public function __construct() { |
||
40 | add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
||
41 | add_action( 'woocommerce_sections_' . $this->id, array( $this, 'output_sections' ) ); |
||
42 | add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) ); |
||
43 | add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) ); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Get settings page ID. |
||
48 | * @since 2.7.0 |
||
49 | * @return string |
||
50 | */ |
||
51 | public function get_id() { |
||
54 | |||
55 | /** |
||
56 | * Get settings page label. |
||
57 | * @since 2.7.0 |
||
58 | * @return string |
||
59 | */ |
||
60 | public function get_label() { |
||
63 | |||
64 | /** |
||
65 | * Add this page to settings. |
||
66 | */ |
||
67 | public function add_settings_page( $pages ) { |
||
72 | |||
73 | /** |
||
74 | * Get settings array. |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | public function get_settings() { |
||
81 | |||
82 | /** |
||
83 | * Get sections. |
||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | public function get_sections() { |
||
90 | |||
91 | /** |
||
92 | * Output sections. |
||
93 | */ |
||
94 | public function output_sections() { |
||
113 | |||
114 | /** |
||
115 | * Output the settings. |
||
116 | */ |
||
117 | public function output() { |
||
122 | |||
123 | /** |
||
124 | * Save settings. |
||
125 | */ |
||
126 | public function save() { |
||
136 | } |
||
137 | |||
139 |