acf-ui-options-page-functions.php
7.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?php
/**
* Helper/wrapper Functions for ACF UI Options pages.
*
* @package ACF
*/
/**
* Get an ACF UI options page as an array
*
* @since 6.2
*
* @param int|string $id The post ID being queried.
* @return array|false The UI options page array.
*/
function acf_get_ui_options_page( $id ) {
return acf_get_internal_post_type( $id, 'acf-ui-options-page' );
}
/**
* Retrieves a raw ACF UI options page.
*
* @since 6.2
*
* @param int|string $id The post ID.
* @return array|false The UI options page array.
*/
function acf_get_raw_ui_options_page( $id ) {
return acf_get_raw_internal_post_type( $id, 'acf-ui-options-page' );
}
/**
* Gets a post object for an ACF UI options page.
*
* @since 6.2
*
* @param int|string $id The post ID, key, or name.
* @return object|bool The post object, or false on failure.
*/
function acf_get_ui_options_page_post( $id ) {
return acf_get_internal_post_type_post( $id, 'acf-ui-options-page' );
}
/**
* Returns true if the given identifier is an ACF UI options page key.
*
* @since 6.2
*
* @param string $id The identifier.
* @return bool
*/
function acf_is_ui_options_page_key( $id ) {
return acf_is_internal_post_type_key( $id, 'acf-ui-options-page' );
}
/**
* Validates an ACF UI options page.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array to validate.
* @return array|bool
*/
function acf_validate_ui_options_page( array $ui_options_page = array() ) {
return acf_validate_internal_post_type( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Translates the settings for an ACF UI options page.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array.
* @return array
*/
function acf_translate_ui_options_page( array $ui_options_page ) {
return acf_translate_internal_post_type( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Returns and array of ACF UI options pages for the given $filter.
*
* @since 6.2
*
* @param array $filter An array of args to filter results by.
* @return array
*/
function acf_get_ui_options_pages( array $filter = array() ) {
return acf_get_internal_post_type_posts( 'acf-ui-options-page', $filter );
}
/**
* Returns an array of raw ACF UI options pages.
*
* @since 6.2
*
* @return array
*/
function acf_get_raw_ui_options_pages() {
return acf_get_raw_internal_post_type_posts( 'acf-ui-options-page' );
}
/**
* Returns a filtered array of ACF UI options pages based on the given $args.
*
* @since 6.2
*
* @param array $ui_options_pages An array of ACF UI options pages.
* @param array $args An array of args to filter by.
* @return array
*/
function acf_filter_ui_options_pages( array $ui_options_pages, array $args = array() ) {
return acf_filter_internal_post_type_posts( $ui_options_pages, $args, 'acf-ui-options-page' );
}
/**
* Updates an ACF UI options page in the database.
*
* @since 6.2
*
* @param array $ui_options_page The main ACF UI options page array.
* @return array
*/
function acf_update_ui_options_page( array $ui_options_page ) {
return acf_update_internal_post_type( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Deletes all caches for the provided ACF UI options page.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array.
* @return void
*/
function acf_flush_ui_options_page_cache( array $ui_options_page ) {
acf_flush_internal_post_type_cache( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Deletes an ACF UI options page from the database.
*
* @since 6.2
*
* @param int|string $id The ACF UI options page ID, key or name.
* @return bool True if the options page was deleted.
*/
function acf_delete_ui_options_page( $id = 0 ) {
return acf_delete_internal_post_type( $id, 'acf-ui-options-page' );
}
/**
* Trashes an ACF UI options page.
*
* @since 6.2
*
* @param int|string $id The UI options page ID, key, or name.
* @return bool True if the options page was trashed.
*/
function acf_trash_ui_options_page( $id = 0 ) {
return acf_trash_internal_post_type( $id, 'acf-ui-options-page' );
}
/**
* Restores an ACF UI options page from the trash.
*
* @since 6.2
*
* @param int|string $id The UI options page ID, key, or name.
* @return bool True if the options page was untrashed.
*/
function acf_untrash_ui_options_page( $id = 0 ) {
return acf_untrash_internal_post_type( $id, 'acf-ui-options-page' );
}
/**
* Returns true if the given params match an ACF UI options page.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array.
* @return bool
*/
function acf_is_ui_options_page( $ui_options_page ) {
return acf_is_internal_post_type( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Duplicates an ACF UI options page.
*
* @since 6.2
*
* @param int|string $id The ACF UI options page ID, key or name.
* @param int $new_post_id Optional ID to override.
* @return array|bool The new ACF UI options page, or false on failure.
*/
function acf_duplicate_ui_options_page( $id = 0, $new_post_id = 0 ) {
return acf_duplicate_internal_post_type( $id, $new_post_id, 'acf-ui-options-page' );
}
/**
* Activates or deactivates an ACF UI options page.
*
* @since 6.2
*
* @param int|string $id The ACF UI options page ID, key or name.
* @param bool $activate True if the UI options page should be activated.
* @return bool
*/
function acf_update_ui_options_page_active_status( $id, $activate = true ) {
return acf_update_internal_post_type_active_status( $id, $activate, 'acf-ui-options-page' );
}
/**
* Checks if the current user can edit the UI options page and returns the edit URL.
*
* @since 6.2
*
* @param int $post_id The ACF UI options page ID.
* @return string
*/
function acf_get_ui_options_page_edit_link( $post_id ) {
return acf_get_internal_post_type_edit_link( $post_id, 'acf-ui-options-page' );
}
/**
* Returns a modified ACF UI options page ready for export.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array.
* @return array
*/
function acf_prepare_ui_options_page_for_export( array $ui_options_page = array() ) {
return acf_prepare_internal_post_type_for_export( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Exports an ACF UI options page as PHP.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array.
* @return string|bool
*/
function acf_export_ui_options_page_as_php( array $ui_options_page ) {
return acf_export_internal_post_type_as_php( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Prepares an ACF UI options page for the import process.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array.
* @return array
*/
function acf_prepare_ui_options_page_for_import( array $ui_options_page = array() ) {
return acf_prepare_internal_post_type_for_import( $ui_options_page, 'acf-ui-options-page' );
}
/**
* Imports an ACF UI options page into the database.
*
* @since 6.2
*
* @param array $ui_options_page The ACF UI options page array.
* @return array The imported options page.
*/
function acf_import_ui_options_page( array $ui_options_page ) {
return acf_import_internal_post_type( $ui_options_page, 'acf-ui-options-page' );
}