1 | <?php |
||
9 | class Data_Manager { |
||
10 | |||
11 | /** |
||
12 | * Special field types, that require |
||
13 | * different data loading |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | public $special_field_types = array( |
||
18 | 'complex', |
||
19 | 'relationship', |
||
20 | 'association', |
||
21 | 'map' |
||
|
|||
22 | ); |
||
23 | |||
24 | /** |
||
25 | * Field types that should be excluded |
||
26 | * from the REST response |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $exclude_field_types = array( |
||
31 | 'html', |
||
32 | 'separator', |
||
33 | ); |
||
34 | |||
35 | /** |
||
36 | * Instance of the Container_Validator class |
||
37 | * |
||
38 | * @var object |
||
39 | */ |
||
40 | public $container_validator; |
||
41 | |||
42 | public function __construct( $validator ) { |
||
45 | |||
46 | /** |
||
47 | * Returns the Carbon Fields data based |
||
48 | * on $type and $id |
||
49 | * |
||
50 | * @param string $type |
||
51 | * @param string $id |
||
52 | * @return array |
||
53 | */ |
||
54 | public function get_data( $type, $id = '' ) { |
||
77 | |||
78 | /** |
||
79 | * Filters all available containers |
||
80 | * based on $type |
||
81 | * |
||
82 | * @param string $type |
||
83 | * @param string $id |
||
84 | * @return array |
||
85 | */ |
||
86 | public function filter_containers( $type, $id = '' ) { |
||
91 | |||
92 | /** |
||
93 | * Checks if fields should be excluded from the response |
||
94 | * |
||
95 | * @param array $fields |
||
96 | * @return array |
||
97 | */ |
||
98 | public function filter_fields( $fields ) { |
||
101 | |||
102 | /** |
||
103 | * Checks if a field should be excluded from the response |
||
104 | * |
||
105 | * @param object $field |
||
106 | * @return array |
||
107 | */ |
||
108 | public function should_load_field( $field ) { |
||
111 | |||
112 | /** |
||
113 | * Loads field value |
||
114 | * |
||
115 | * @param object $field |
||
116 | * @return array |
||
117 | */ |
||
118 | public function load_generic_field_value( $field ) { |
||
121 | |||
122 | /** |
||
123 | * Loads the value of a complex field |
||
124 | * |
||
125 | * @param object $field |
||
126 | * @return array |
||
127 | */ |
||
128 | public function load_complex_field_value( $field ) { |
||
132 | |||
133 | /** |
||
134 | * Load the value of a map field |
||
135 | * |
||
136 | * @param object $field |
||
137 | * @return array |
||
138 | */ |
||
139 | public function load_map_field_value( $field ) { |
||
149 | |||
150 | /** |
||
151 | * Loads the value of a relationship field |
||
152 | * |
||
153 | * @param object $field |
||
154 | * @return array |
||
155 | */ |
||
156 | public function load_relationship_field_value( $field ) { |
||
159 | |||
160 | /** |
||
161 | * Loads the value of an association field |
||
162 | * |
||
163 | * @param object $field |
||
164 | * @return array |
||
165 | */ |
||
166 | public function load_association_field_value( $field ) { |
||
170 | } |