1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace WC_POS\Admin\Settings;
13
14 class Receipts extends Page {
15
16 protected static $instance;
17
18 19 20
21 public function __construct() {
22 $this->id = 'receipts';
23 $this->label = __( 'Receipts', 'woocommerce-pos' );
24
25 $this->section_handlers = array(
26 'receipt_options' => '\WC_POS\Admin\Settings\Receipt\Options',
27 'receipt_template' => '\WC_POS\Admin\Settings\Receipt\Template'
28 );
29 }
30
31 32 33 34
35 public function get( $args = null ) {
36 $section = isset( $args[ 'section' ] ) ? $args[ 'section' ] : $args;
37 $key = isset( $args[ 'key' ] ) ? $args[ 'key' ] : null;
38
39 if ( $section ) {
40 $handler = $this->section_handlers[ $section ];
41 if ( $handler ) {
42 $settings = $handler::get_instance();
43 return $settings->get( $key );
44 }
45 return false;
46 }
47
48 $data = array();
49 foreach ( $this->section_handlers as $id => $handler ) {
50 $settings = $handler::get_instance();
51 $data[ $key ] = $settings->get();
52 }
53 return $data;
54
55 }
56
57 }